├── .gitignore ├── README.md └── script.py /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | *.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IGetGet 2 | 3 | IGetGet Books Spider by MitmDump -------------------------------------------------------------------------------- /script.py: -------------------------------------------------------------------------------- 1 | import json 2 | import pymongo 3 | from mitmproxy import ctx 4 | 5 | client = pymongo.MongoClient('localhost') 6 | db = client['igetget'] 7 | collection = db['books'] 8 | 9 | 10 | def response(flow): 11 | global collection 12 | url = 'https://dedao.igetget.com/v3/discover/bookList' 13 | if flow.request.url.startswith(url): 14 | text = flow.response.text 15 | data = json.loads(text) 16 | books = data.get('c').get('list') 17 | for book in books: 18 | data = { 19 | 'title': book.get('operating_title'), 20 | 'cover': book.get('cover'), 21 | 'summary': book.get('other_share_summary'), 22 | 'price': book.get('price') 23 | } 24 | ctx.log.info(str(data)) 25 | collection.insert(data) 26 | --------------------------------------------------------------------------------