コード例 #1
0
ファイル: tasks.py プロジェクト: wangyiyang/hellokitty
def get_keyworld(keyworld_pages):
    for keyworld_page in keyworld_pages:
        headers = {
            'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
            'Referer': 'http://www.zhihu.com/articles'
        }
        try:
            request = urllib2.Request(
                url="http://www.torrentkitty.org{link}".format(
                    link=keyworld_page.get("href")),
                headers=headers)
            response = urllib2.urlopen(request)
            content = response.read()
        except:
            pass
        else:
            if content:
                soup = BeautifulSoup(content)
                results = soup.find_all(href=re.compile("/search/"))
                for result in results:
                    print result
                    link = result.get('href')
                    title = result.get('title')
                    bfs = BF_ROOT.add(link)
                    if bfs is False and title is not None:
                        Rootport.objects.create(
                            title=title,
                            link="http://www.torrentkitty.org{link}".format(
                                link=link))
コード例 #2
0
ファイル: tasks.py プロジェクト: jiaxiaolei/hellokitty
def get_root_port():
    headers = {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
               'Referer': 'http://www.zhihu.com/articles'}
    request = urllib2.Request(
        url="http://www.torrentkitty.org/search/", headers=headers)
    response = urllib2.urlopen(request)
    content = response.read()
    if content:
        soup = BeautifulSoup(content)
        results = soup.find_all(href=re.compile("/search/"))
        for result in results:
            link = result.get('href')
            title = result.string
            bfs = BF_ROOT.add(link)
            if bfs is False:
                Rootport.objects.create(
                    title=title, link="http://www.torrentkitty.org{link}".format(link=link))
コード例 #3
0
ファイル: tasks.py プロジェクト: wangyiyang/hellokitty
def get_root_port():
    headers = {
        'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
        'Referer': 'http://www.zhihu.com/articles'
    }
    request = urllib2.Request(url="http://www.torrentkitty.org/search/",
                              headers=headers)
    response = urllib2.urlopen(request)
    content = response.read()
    if content:
        soup = BeautifulSoup(content)
        results = soup.find_all(href=re.compile("/search/"))
        for result in results:
            link = result.get('href')
            title = result.string
            bfs = BF_ROOT.add(link)
            if bfs is False:
                Rootport.objects.create(
                    title=title,
                    link="http://www.torrentkitty.org{link}".format(link=link))
コード例 #4
0
ファイル: tasks.py プロジェクト: jiaxiaolei/hellokitty
def get_keyworld(keyworld_pages):
    for keyworld_page in keyworld_pages:
        headers = {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
                   'Referer': 'http://www.zhihu.com/articles'}
        try:
            request = urllib2.Request(url="http://www.torrentkitty.org{link}".format(link=keyworld_page.get("href")),
                                      headers=headers)
            response = urllib2.urlopen(request)
            content = response.read()
        except:
            pass
        else:
            if content:
                soup = BeautifulSoup(content)
                results = soup.find_all(href=re.compile("/search/"))
                for result in results:
                    print result
                    link = result.get('href')
                    title = result.get('title')
                    bfs = BF_ROOT.add(link)
                    if bfs is False and title is not None:
                        Rootport.objects.create(
                            title=title, link="http://www.torrentkitty.org{link}".format(link=link))