Skip to content

Python crawler crawling some websites(mafengwo、tripAdvisor、ctrip) travel notes and Save to mongodb database

Notifications You must be signed in to change notification settings

pf12345/python-for-travel-notes

Repository files navigation

python-for-travel-notes

Python crawler crawling some websites(mafengwo、tripAdvisor) travel notes and Save to mongodb database(使用python写的爬虫爬取一些旅游网站(如,蚂蜂窝、tripadvisor)中旅游游记,并将保持至mongodb数据库)

Install

Use python 2.7mongodbPyMongo and Django-1.11 in project

Copy codes

$ git clone https://github.com/pf12345/python-for-travel-notes.git

Config mongodb

Go to the code folder and enter:

$ cd ./tourism/settings.py

find line 83, modify "DBNAME" to your db name and Create a collection named "tourism" in db

Run server

Go to the code folder and enter:

$ python manage.py runserver

Open your browser and visit http://127.0.0.1:8000

Crawling article

for example:

Auto crawler(自动抓取)

Go to the code folder and enter:

//蚂蜂窝游记自动爬取(auto crawler mafengwo)
$ cd tourism
$ cd autoCrawler
$ python mafengwo.py

//携程游记自动爬取(auto crawler ctrip)
$ cd tourism
$ cd autoCrawler
$ python ctrip.py

Urls

LINKS

About

Python crawler crawling some websites(mafengwo、tripAdvisor、ctrip) travel notes and Save to mongodb database

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages