X Tutup
The Wayback Machine - https://web.archive.org/web/20200902013748/https://github.com/TheAlgorithms/Python/issues/2379
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python crawler keeps crawling the content of the first page repeatedly #2379

Open
Q-yh-ouo opened this issue Sep 1, 2020 · 0 comments
Open

Python crawler keeps crawling the content of the first page repeatedly #2379

Q-yh-ouo opened this issue Sep 1, 2020 · 0 comments

Comments

@Q-yh-ouo
Copy link

@Q-yh-ouo Q-yh-ouo commented Sep 1, 2020

import requests import urllib from lxml import html #需要爬数据的网址 j=0 #!s-p3 for k in range(1,20): url='https://www.duitang.com/search/?kw=%E6%AD%A3%E5%A4%AA&type=feed'+'#!s-p'+str(k) page=requests.Session().get(url) tree=html.fromstring(page.text) result=tree.xpath('//a[@class="a"]//img/@src') #获取需要的数据 for i in result: urllib.request.urlretrieve(i,'C://Users//FangJZ//Desktop//duitan//'+(str(j))+'.jpg') j=j+1 print('true')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.
X Tutup