InvalidSchema(“No connection adapters were found for '%s'” % url)

后端 未结 1 1266
花落未央
花落未央 2021-01-29 10:44

I was able to gather data from a web page using this

import requests
import lxml.html
import re
url = \"http://animesora.com/flying-witch-episode-7-english-subt         


        
相关标签:
1条回答
  • 2021-01-29 11:11

    You are passing in the whole list:

    for link2 in down:
        r2 = requests.get(down)
    

    Note how you passed in down, not link2. down is a list, not a single URL string.

    Pass in link2:

    for link2 in down:
        r2 = requests.get(link2)
    

    I'm not sure why you are using regular expressions. In the loop

    for link in dom.xpath('//div[@class="downloadarea"]//a/@href'):
    

    each link is already a fully qualified URL:

    >>> for link in dom.xpath('//div[@class="downloadarea"]//a/@href'):
    ...     print link
    ...
    https://link.safelinkconverter.com/review.php?id=aHR0cDovLygqKC5fKC9FZEk2Qg==&c=1&user=51757
    https://link.safelinkconverter.com/review.php?id=aHR0cDovLygqKC5fKC95Tmg2Qg==&c=1&user=51757
    https://link.safelinkconverter.com/review.php?id=aHR0cDovLygqKC5fKC93dFBmVFg=&c=1&user=51757
    https://link.safelinkconverter.com/review.php?id=aHR0cDovLygqKC5fKC9zTGZYZ0s=&c=1&user=51757
    

    You don't need to do any further processing on that.

    Your remaining code has more errors; you confused r2.url with r2.content, and forgot the .xpath part in your dom2.xpath(...) query.

    0 讨论(0)
提交回复
热议问题