Web Scraping With Python Richard Lawson Instant Download
Web Scraping With Python Richard Lawson Instant Download
https://ebookbell.com/product/web-scraping-with-python-richard-
lawson-5294686
Web Scraping With Python Collecting More Data From The Modern Web 2nd
Edition Ryan Mitchell
https://ebookbell.com/product/web-scraping-with-python-collecting-
more-data-from-the-modern-web-2nd-edition-ryan-mitchell-55670256
Web Scraping With Python Data Extraction From The Modern Web 3
Converted Ryan Mitchell
https://ebookbell.com/product/web-scraping-with-python-data-
extraction-from-the-modern-web-3-converted-ryan-mitchell-55771382
Web Scraping With Python Collecting Data From The Modern Web Ryan
Mitchell
https://ebookbell.com/product/web-scraping-with-python-collecting-
data-from-the-modern-web-ryan-mitchell-36521744
Web Scraping With Python Collecting Data From The Modern Web Ryan
Mitchell
https://ebookbell.com/product/web-scraping-with-python-collecting-
data-from-the-modern-web-ryan-mitchell-42892066
Web Scraping With Python Collecting Data From The Modern Web 1st
Edition Ryan Mitchell
https://ebookbell.com/product/web-scraping-with-python-collecting-
data-from-the-modern-web-1st-edition-ryan-mitchell-5151034
https://ebookbell.com/product/web-scraping-with-python-2nd-edition-
ryan-mitchell-10811388
https://ebookbell.com/product/web-scraping-with-python-ryan-
mitchell-55788286
Web Scraping With Python Collecting More Data From The Modern Web Ryan
Mitchell
https://ebookbell.com/product/web-scraping-with-python-collecting-
more-data-from-the-modern-web-ryan-mitchell-37669998
https://ebookbell.com/product/web-scraping-with-python-3rd-edition-
ryan-mitchell-55771772
Web Scraping with Python
Richard Lawson
BIRMINGHAM - MUMBAI
Web Scraping with Python
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78216-436-4
www.packtpub.com
Credits
Reviewers Proofreader
Martin Burch Safis Editing
Christopher Davis
William Sankey Indexer
Mariammal Chettiar
Ayush Tiwari
Production Coordinator
Acquisition Editor
Nilesh R. Mohite
Rebecca Youé
Cover Work
Content Development Editor
Nilesh R. Mohite
Akashdeep Kundu
Technical Editors
Novina Kewalramani
Shruti Rawool
Copy Editor
Sonia Cheema
About the Author
Richard Lawson is from Australia and studied Computer Science at the University
of Melbourne. Since graduating, he built a business specializing at web scraping
while traveling the world, working remotely from over 50 countries. He is a
fluent Esperanto speaker, conversational at Mandarin and Korean, and active in
contributing to and translating open source software. He is currently undertaking
postgraduate studies at Oxford University and in his spare time enjoys developing
autonomous drones.
Martin Burch is a data journalist based in New York City, where he makes
interactive graphics for The Wall Street Journal. He holds a master of arts in
journalism from the City University of New York's Graduate School of Journalism,
and has a baccalaureate from New Mexico State University, where he studied
journalism and information systems.
He is enthusiastic about Python web scraping and has worked on projects such as live
sports feeds, as well as a generalized Python e-commerce web scraper (at Miranj).
He has also been handling a placement portal with the help of a Django app to assist
the placement process at IIT Roorkee.
I have been provided a lot of help by my family members (my sister, Aditi, my
parents, and Anand sir), my friends at VI and IMG, and my professors. I would like
to thank all of them for the support they have given me.
Last but not least, kudos to the respected author and the Packt Publishing team
for publishing these fantastic tech books. I commend all the hard work involved in
producing their books.
www.PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.
TM
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
[i]
Table of Contents
Comparing performance 29
Scraping results 30
Overview 32
Adding a scrape callback to the link crawler 32
Summary 34
Chapter 3: Caching Downloads 35
Adding cache support to the link crawler 35
Disk cache 37
Implementation 39
Testing the cache 40
Saving disk space 41
Expiring stale data 41
Drawbacks 43
Database cache 44
What is NoSQL? 44
Installing MongoDB 44
Overview of MongoDB 45
MongoDB cache implementation 46
Compression 47
Testing the cache 48
Summary 48
Chapter 4: Concurrent Downloading 49
One million web pages 49
Parsing the Alexa list 50
Sequential crawler 51
Threaded crawler 52
How threads and processes work 52
Implementation 53
Cross-process crawler 55
Performance 58
Summary 59
Chapter 5: Dynamic Content 61
An example dynamic web page 62
Reverse engineering a dynamic web page 64
Edge cases 67
Rendering a dynamic web page 69
PyQt or PySide 69
Executing JavaScript 70
[ ii ]
Table of Contents
[ iii ]
Table of Contents
[ iv ]
Preface
The Internet contains the most useful set of data ever assembled, which is largely
publicly accessible for free. However, this data is not easily reusable. It is embedded
within the structure and style of websites and needs to be extracted to be useful.
This process of extracting data from web pages is known as web scraping and is
becoming increasingly useful as ever more information is available online.
Chapter 2, Scraping the Data, shows you how to extract data from web pages.
Chapter 5, Dynamic Content, shows you how to extract data from dynamic websites.
Chapter 6, Interacting with Forms, shows you how to work with forms to access the
data you are after.
[v]
Preface
Chapter 8, Scrapy, teaches you how to use the popular high-level Scrapy framework.
Chapter 9, Overview, is an overview of web scraping techniques that have been covered.
We decided to build a custom website for many of the examples used in this book
instead of scraping live websites, so that we have full control over the environment.
This provides us stability—live websites are updated more often than books, and by
the time you try a scraping example, it may no longer work. Also, a custom website
allows us to craft examples that illustrate specific skills and avoid distractions. Finally,
a live website might not appreciate us using them to learn about web scraping and try
to block our scrapers. Using our own custom website avoids these risks; however, the
skills learnt in these examples can certainly still be applied to live websites.
The examples also assume knowledge of how web pages are constructed with HTML
and updated with JavaScript. Prior knowledge of HTTP, CSS, AJAX, WebKit, and
MongoDB would also be useful, but not required, and will be introduced as and
when each technology is needed. Detailed references for many of these topics are
available at http://www.w3schools.com.
[ vi ]
Preface
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
Code words in text are shown as follows: "Most websites define a robots.txt file to
let robots know any restrictions about crawling their website."
When we wish to draw your attention to a particular part of a code block, the
relevant lines or items are set in bold:
def link_crawler(..., scrape_callback=None):
…
links = []
if scrape_callback:
links.extend(scrape_callback(url, html) or [])
...
[ vii ]
Preface
New terms and important words are shown in bold. Words that you see on the
screen, in menus or dialog boxes for example, appear in the text like this: " When
regular users open this web page in their browser, they will enter their e-mail and
password, and click on the Log In button to submit the details to the server."
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or may have disliked. Reader feedback is important for us
to develop titles that you really get the most out of.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you would report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/support, selecting your book, clicking on the errata submission form link, and
entering the details of your errata. Once your errata are verified, your submission
will be accepted and the errata will be uploaded to our website, or added to any list
of existing errata, under the Errata section of that title.
[ viii ]
Preface
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media.
At Packt, we take the protection of our copyright and licenses very seriously. If you
come across any illegal copies of our works, in any form, on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
We appreciate your help in protecting our authors, and our ability to bring you
valuable content.
Questions
You can contact us at questions@packtpub.com if you are having a problem with
any aspect of the book, and we will do our best to address it.
[ ix ]
Random documents with unrelated
content Scribd suggests to you:
will be regarded as a line more nearly parallel and equal to the side
forming the length of that figure than the diagonal of any of the
smaller parallelograms: and the more your lesser parallelograms
should be multiplied, the more will this become evident. Certainly, it
is in great figures that the obliquity of the diagonal and its difference
from the side forming the length are the less perceptible, so that you
would have but little scruple in taking the diagonal as the length of
the figure. But if you draw the diagonal more inclined, so that it falls
beyond both sides, or at least beyond one of the sides, then will this
no longer be the case; and this is the sense in which we have
observed, that when you attempted to draw even in a very general
way the extents of the figures, you ought to adopt some rule. But
Eratosthenes takes a line from the Caspian Gates along the
mountains, running as it were in the same parallel as far as the
Pillars, and then a second line, starting directly from the mountains
to touch Thapsacus; and again a third line from Thapsacus to the
frontiers of Egypt, occupying so great a breadth. If then in
proceeding you give the length of the two last lines [taken together]
as the measure of the length of the district, you will appear to
measure the length of one of your parallelograms by its diagonal.
And if, farther, this diagonal should consist of a broken line, as that
would be which stretches from the Caspian Gates to the
embouchure of the Nile, passing by Thapsacus, your error will
appear much greater. This is the sum of what may be alleged
against Eratosthenes.
38. In another respect also we have to complain of Hipparchus,
because, as he had given a category of the statements of
Eratosthenes, he ought to have corrected his mistakes, in the same
way that we have done; but whenever he has any thing particular to
remark, he tells us to follow the ancient charts, which, to say the
least, need correction infinitely more than the map of Eratosthenes.
The argument which follows is equally objectionable, being founded
on the consequences of a proposition which, as we have shown, is
inadmissible, namely, that Babylon was not more than 1000 stadia
east of Thapsacus; when it was quite clear, from Eratosthenes’ own
words, that Babylon was above 2400 stadia east of that place; since
from Thapsacus to the passage of the Euphrates where it was
crossed by Alexander, the shortest route is 2400 stadia, and the
Tigris and Euphrates, having encompassed Mesopotamia, flow
towards the east, and afterwards take a southerly direction and
approach nearer to each other and to Babylon at the same time:
nothing appears absurd in this statement of Eratosthenes.
39. The next objection of Hipparchus is likewise false. He attempts
to prove that Eratosthenes, in his statement that the route from
Thapsacus to the Caspian Gates is 10,000 stadia, gives this as the
distance taken in a straight line; such not being the case, as in that
instance the distance would be much shorter. His mode of reasoning
is after this fashion. He says, “According to Eratosthenes, the mouth
of the Nile at Canopus,600 and the Cyaneæ,601 are under the same
meridian, which is distant from that of Thapsacus 6300 stadia. Now
from the Cyaneæ to Mount Caspius, which is situated close to the
defile602 leading from Colchis to the Caspian Sea, there are 6600
stadia,603 so that, with the exception of about 300 stadia, the
distance from the meridian of the Cyaneæ to that of Thapsacus, or
to that of Mount Caspius, is the same: and both Thapsacus and
Mount Caspius are, so to speak, under the same meridian.604 It
follows from this that the Caspian Gates are about equi-distant
between Thapsacus and Mount Caspius, but that the distance
between them and Thapsacus is much less than the 10,000 stadia
mentioned by Eratosthenes. Consequently, as the distance in a right
line is much less than 10,000 stadia, this route, which he considered
to be in a straight course from the Caspian Gates to Thapsacus,
must have been a circumbendibus.”
To this we reply, that Eratosthenes, as is usual in Geography, speaks
of right lines, meridians, and parallels to the equator, with
considerable latitude, whereas Hipparchus criticizes him with
geometrical nicety, as if every line had been measured with rule and
compass. Hipparchus at the same time himself frequently deciding
as to right lines and parallels, not by actual measurement, but mere
conjecture. Such is the first error of this writer. A second is, that he
never lays down the distances as Eratosthenes has given them, nor
yet reasons on the data furnished by that writer, but from mere
assumptions of his own coinage. Thus, where Eratosthenes states
that the distance from the mouth of the [Thracian Bosphorus] to the
Phasis is 8000 stadia, from thence to Dioscurias 600 stadia,605 and
from Dioscurias to Caspius five days’ journey, (which Hipparchus
estimates at 1000 stadia,) the sum of these, as stated by
Eratosthenes, would amount to 9600 stadia. This Hipparchus
abridges in the following manner. From the Cyaneæ to the Phasis
are 5600 stadia, and from the Phasis to the Caspius 1000 more.606
Therefore it is no statement of Eratosthenes that the Caspius and
Thapsacus are under the same meridian, but of Hipparchus himself.
However, supposing Eratosthenes says so, does it follow that the
distance from the Caspius to the Caspian Gates, and that from
Thapsacus to the same point, are equal.607
40. In the second book of his Commentaries, Hipparchus, having
again mooted the question concerning the mountains of the Taurus,
of which we have spoken sufficiently, proceeds with the northern
parts of the habitable earth. He then notices the statement of
Eratosthenes concerning the countries situated west of the
Euxine,608 namely, that the three [principal] headlands [of this
continent], the first the Peloponnesian, the second the Italian, the
third the Ligurian, run from north [to south], enclosing the Adriatic
and Tyrrhenian Gulfs.609 After this general exposition, Hipparchus
proceeds to criticise each point in detail, but rather on geometrical
than geographical grounds; on these subjects, however, the number
of Eratosthenes’ errors is so overwhelming, as also of Timosthenes
the author of the Treatise on the Ports, (whom Eratosthenes prefers
above every other writer, though he often decides even against him,)
that it does not seem to be worth my time to review their faulty
productions, nor even what Hipparchus has to say about them; since
he neither enumerates all their blunders, nor yet sets them right, but
only points out how they falsify and contradict each other. Still any
one might certainly object to the saying of Eratosthenes, that Europe
has but three headlands, and considering as one that which
terminates by the Peloponnesus, notwithstanding it is broken up into
so many divisions. In fact, Sunium610 is as much a promontory as
Laconia, and not very much less south than Malea,611 forming a
considerable bay,612 and the Thracian Chersonesus613 and Sunium614
form the Gulf of Melas,615 and likewise those of Macedonia.616
Added to this, it is manifest that the majority of the distances are
falsely stated, thus arguing an ignorance of geography scarcely
credible, and so far from requiring geometrical demonstration that it
stands out prominent on the very face of the statements. For
example, the distance from Epidamnus617 to the Thermaic Gulf618 is
above 2000 stadia; Eratosthenes gives it at 900. So too he states the
distance from Alexandria to Carthage at 13,000619 stadia; it is not
more than 9000, that is, if, as he himself tells us, Caria and Rhodes
are under the same meridian as Alexandria,620 and the Strait of
Messina under the same as Carthage,621 for every one is agreed that
the voyage from Caria to the Strait of Sicily does not exceed 9000
stadia.
It is doubtless permissible in very great distances to consider as
under one and the same meridian places which are not more east
and west of each other than Carthage is west of the Strait;622 but an
error of 3000 stadia is too much; and when he places Rome under
the same meridian as Carthage, notwithstanding its being so far
west of that city, it is but the crowning proof of his extreme
ignorance both of these places, and likewise of the other countries
farther west as far as the Pillars of Hercules.
41. Since Hipparchus does not furnish a Geography of his own, but
merely reviews what is said in that of Eratosthenes, he ought to
have gone farther, and corrected the whole of that writer’s mistakes.
As for ourselves, it is only in those particulars where Eratosthenes is
correct (and we acknowledge that he frequently errs) that we have
thought it our duty to quote his own words, in order to reinstate
them in their position, and to defend him when he could be
acquitted of the charges of Hipparchus; never failing to break a
lance with the latter writer whenever his objections seemed to be
the result of a mere propensity to find fault. But when Eratosthenes
is grossly mistaken, and the animadversions of Hipparchus are just,
we have thought it sufficient in our Geography to set him
(Eratosthenes) right by merely stating facts as they are. As the
mistakes were so continual and numerous, it was better not to
mention them except in a sparse and general manner. This principle
in the details we shall strive to carry out. In the present instance we
shall only remark, that Timosthenes, Eratosthenes, and those who
preceded them, were but ill acquainted with Iberia and Keltica,623
and a thousand times less with Germany, Britain, and the land of the
Getæ and Bastarnæ.624 Their want of knowledge is also great in
regard to Italy, the Adriatic, the Euxine, and the countries north of
these. Possibly this last remark may be regarded as captious, since
Eratosthenes states, that as to distant countries, he has merely
given the admeasurements as he finds them supplied by others,
without vouching for their accuracy, although he sometimes adds
whether the route indicated is more or less in a right line. We should
not therefore subject to a too rigorous examination distances as to
which no one is agreed, after the manner Hipparchus does, both in
regard to the places already mentioned, and also to those of which
Eratosthenes has given the distance from Hyrcania to Bactria and
the countries beyond, and those from Colchis to the Sea of Hyrcania.
These are points where we should not scrutinize him so narrowly as
[when he describes] places situated in the heart of our continent,625
or others equally well known; and even these should be regarded
from a geographical rather than a geometrical point of view.
Hipparchus, at the end of the second book of his Commentaries on
the Geography of Eratosthenes, having found fault with certain
statements relative to Ethiopia, tells us at the commencement of the
third, that his strictures, though to a certain point geographical, will
be mathematical for the most part. As for myself, I cannot find any
geography there. To me it seems entirely mathematical; but
Eratosthenes himself set the example; for he frequently runs into
scientific speculations, having little to do with the subject in hand,
and which result in vague and inexact conclusions. Thus he is a
mathematician in geography, and in mathematics a geographer; and
so lies open to the attacks of both parties. In this third book, both
he and Timosthenes get such severe justice, that there seems
nothing left for us to do; Hipparchus is quite enough.
CHAPTER II.
CHAPTER III.
1. Polybius supposes six zones: two situated between the poles and
the arctic circles; two between the arctic circles and the tropics; and
two between the tropics which are divided by the equator. However,
it appears to me that the division into five zones accords best both
with the order of external nature and geography. With external
nature, as respects the celestial phenomena, and the temperature of
the atmosphere. With respect to the celestial phenomena, as the
Periscii and Amphiscii are thereby divided in the best possible
manner, and it also forms an excellent line of separation in regard to
those who behold the stars from an opposite point of view.639 With
respect to the temperature of the atmosphere, inasmuch as looked
at in connexion with the sun, there are three main divisions, which
influence in a remarkable degree both plants, animals, and every
other animated thing, existing either in the air, or exposed to it,
namely, excess of heat, want of heat, and a moderate supply of
heat. In the division into [five] zones, each of these is correctly
distinguished. The two frigid zones indicate the want of heat, being
alike in the temperature of their atmosphere; the temperate zones
possess a moderate heat, and the remaining, or torrid zone, is
remarkable for its excess of heat.
The propriety of this division in regard to geography is equally
apparent; the object of this science being to determine the limits of
that one of the temperate zones which we inhabit. To the east and
west, it is true, the boundaries are formed by the sea, but to the
north and south they are indicated by the atmosphere; which in the
middle is of a grateful temperature both to animals and plants, but
on either side is rendered intemperate either through excess or
defect of heat. To manifest this threefold difference, the division of
the globe into five zones becomes necessary. In fact, the division of
the globe, by means of the equator, into two hemispheres, the one
northern, wherein we dwell, and the other southern, points to this
threefold division, for the regions next the equator and torrid zone
are uninhabitable on account of the heat, those next the poles on
account of the cold, but those in the middle are mild, and fitted for
the habitation of man.
Posidonius, in placing two zones under the tropics, pays no regard to
the reasons which influenced the division into five zones, nor is his
division equally appropriate. It is no more than if he were to form his
division into zones merely according to the [countries inhabited] by
different nations, calling one the Ethiopian, another the Scythian and
Keltic,640 and a third the Intermediate zone.
2. Polybius, indeed, is wrong in bounding certain of his zones by the
arctic circles,641 namely, the two which lie under them, and the two
between these and the tropics. The impropriety of using shifting
points to mark the limits of those which are fixed has been remarked
before; and we have likewise objected to the plan of making the
tropics the boundary of the torrid zone. However, in dividing the
torrid zone into two parts [Polybius] seems to have been influenced
by no inconsiderable reason, the same which led us to regard the
whole earth as properly divided by the equator into two
hemispheres, north and south. We at once see that by means of this
division the torrid zone is divided into two parts, thus establishing a
kind of uniformity; each hemisphere consisting of three entire zones,
respectively similar to each other. Thus this partition642 will admit of
a division into six zones, but the other does not allow of it at all.
Supposing you cut the earth into two portions by a line drawn
through the poles, you can find no sufficient cause for dividing the
eastern and western hemispheres into six zones; on the other hand,
five would be preferable. For since both the portions of the torrid
zone, divided by the equator, are similar and contiguous to each
other, it would seem out of place and superfluous to separate them;
whereas the temperate and frigid zones respectively resemble each
other, although lying apart. Wherefore, supposing the whole earth to
consist of these two hemispheres, it is sufficient to divide them into
five zones. If there be a temperate region under the equator, as
Eratosthenes asserts, and is admitted by Polybius, (who adds, that it
is the most elevated part of the earth,643 and consequently subject
to the drenching rains occasioned by the monsoons bringing up from
the north innumerable clouds, which discharge themselves on the
highest lands,) it would be better to suppose this a third narrow
temperate zone, than to extend the two temperate zones within the
circles of the tropics. This supposition is supported by the
statements of Posidonius, that the course of the sun, whether in the
ecliptic, or from east to west, appears most rapid in the region [of
which we are speaking], because the rotations of that luminary are
performed with a speed increased in proportion to the greater size of
the circle.644
3. Posidonius blames Polybius for asserting that the region of the
earth, situated under the equator, is the highest, since a spherical
body being equal all round, no part can be described as high; and as
to mountainous districts, there are none under the equator, it is on
the contrary a flat country, about the same level as the sea; as for
the rains which swell the Nile, they descend from the mountains of
Ethiopia. Although advancing this, he afterwards seems to adopt the
other opinion, for he says that he fancies there may be mountains
under the equator, around which the clouds assembling from both of
the temperate zones, produce violent rains. Here is one manifest
contradiction; again, in stating that the land under the equator is
mountainous, another contradiction appears. For they say that the
ocean is confluent, how then can they place mountains in the midst
of it? unless they mean to say that there are islands. However,
whether such be the fact does not lie within the province of
geography to determine, the inquiry would better be left to him who
makes the ocean in particular his study.
4. Posidonius, in speaking of those who have sailed round Africa,
tells us that Herodotus was of opinion that some of those sent out
by Darius actually performed this enterprise;645 and that Heraclides
of Pontus, in a certain dialogue, introduces one of the Magi
presenting himself to Gelon,646 and declaring that he had performed
this voyage; but he remarks that this wants proof. He also narrates
how a certain Eudoxus of Cyzicus,647 sent with sacrifices and
oblations to the Corean games,648 travelled into Egypt in the reign of
Euergetes II.;649 and being a learned man, and much interested in
the peculiarities of different countries, he made interest with the
king and his ministers on the subject, but especially for exploring the
Nile. It chanced that a certain Indian was brought to the king by the
[coast]-guard of the Arabian Gulf. They reported that they had found
him in a ship, alone, and half dead: but that they neither knew who
he was, nor where he came from, as he spoke a language they
could not understand. He was placed in the hands of preceptors
appointed to teach him the Greek language. On acquiring which, he
related how he had started from the coasts of India, but lost his
course, and reached Egypt alone, all his companions having perished
with hunger; but that if he were restored to his country he would
point out to those sent with him by the king, the route by sea to
India. Eudoxus was of the number thus sent. He set sail with a good
supply of presents, and brought back with him in exchange
aromatics and precious stones, some of which the Indians collect
from amongst the pebbles of the rivers, others they dig out of the
earth, where they have been formed by the moisture, as crystals are
formed with us.650
[He fancied that he had made his fortune], however, he was greatly
deceived, for Euergetes took possession of the whole treasure. On
the death of that prince, his widow, Cleopatra,651 assumed the reins
of government, and Eudoxus was again despatched with a richer
cargo than before. On his journey back, he was carried by the winds
above Ethiopia, and being thrown on certain [unknown] regions, he
conciliated the inhabitants by presents of grain, wine, and cakes of
pressed figs, articles which they were without; receiving in exchange
a supply of water, and guides for the journey. He also wrote down
several words of their language, and having found the end of a
prow, with a horse carved on it, which he was told formed part of
the wreck of a vessel coming from the west, he took it with him, and
proceeded on his homeward course. He arrived safely in Egypt,
where no longer Cleopatra, but her son,652 ruled; but he was again
stripped of every thing on the accusation of having appropriated to
his own uses a large portion of the merchandise sent out.
However, he carried the prow into the market-place, and exhibited it
to the pilots, who recognised it as being come from Gades.653 The
merchants [of that place] employing large vessels, but the lesser
traders small ships, which they style horses, from the figures of that
animal borne on the prow, and in which they go out fishing around
Maurusia,654 as far as the Lixus.655 Some of the pilots professed to
recognise the prow as that of a vessel which had sailed beyond the
river Lixus, but had not returned.656
From this Eudoxus drew the conclusion, that it was possible to
circumnavigate Libya; he therefore returned home, and having
collected together the whole of his substance, set out on his travels.
First he visited Dicæarchia,657 and then Marseilles, and afterwards
traversed the whole coast as far as Gades. Declaring his enterprise
everywhere as he journeyed, he gathered money sufficient to equip
a great ship, and two boats, resembling those used by pirates. On
board these he placed singing girls, physicians, and artisans of
various kinds, and launching into open sea, was carried towards
India by steady westerly winds.658 However, they who accompanied
him becoming wearied with the voyage, steered their course towards
land, but much against his will, as he dreaded the force of the ebb
and flow. What he feared actually occurred. The ship grounded, but
gently, so that it did not break up at once, but fell to pieces
gradually, the goods and much of the timber of the ship being saved.
With these he built a third vessel, closely resembling a ship of fifty
oars, and continuing his voyage, came amongst a people who spoke
the same language as that some words of which he had on a former
occasion committed to writing. He further discovered, that they were
men of the same stock as those other Ethiopians, and also
resembled those of the kingdom of Bogus.659 However, he
abandoned his [intended] voyage to India, and returned home. On
his voyage back he observed an uninhabited island, well watered
and wooded, and carefully noted its position. Having reached
Maurusia in safety, he disposed of his vessels, and travelled by land
to the court of Bogus. He recommended that sovereign to undertake
an expedition thither.
This, however, was prevented on account of the fear of the [king’s]
advisers, lest the district should chance to expose them to treachery,
by making known a route by which foreigners might come to attack
them. Eudoxus, however, became aware, that although it was given
out that he was himself to be sent on this proposed expedition, the
real intent was to abandon him on some desert island. He therefore
fled to the Roman territory, and passed thence into Iberia. Again, he
equipped two vessels, one round and the other long, furnished with
fifty oars, the latter framed for voyaging in the high seas, the other
for coasting along the shores. He placed on board agricultural
implements, seed, and builders, and hastened on the same voyage,
determined, if it should prove too long, to winter on the island he
had before observed, sow his seed, and having reaped the harvest,
complete the expedition he had intended from the beginning.
5. “Thus far,” says Posidonius, “I have followed the history of
Eudoxus. What happened afterwards is probably known to the
people of Gades and Iberia;” “but,” says he, “all these things only
demonstrate more clearly the fact, that the inhabited earth is
entirely surrounded by the ocean.”
“By no continent fettered in,
But boundless in its flow, and free from soil.”
CHAPTER IV.
ebookbell.com