コード例 #1
0
ファイル: reddit.py プロジェクト: kootenpv/inthenews.io
def get_posts(conf):
    rows = []
    for url in conf['urls']:
        tree = retry_get_tree(url)
        rows = tree.xpath('//div[@id="siteTable"]/div')
        rows.extend([process_item_fn(row, conf) for row in rows])
    return rows
コード例 #2
0
def get_posts(conf):
    rows = []
    for url in conf['urls']:
        tree = retry_get_tree(url)
        rows = tree.xpath('//li[@class="repo-list-item"]')
        rows.extend([process_item_fn(row) for row in rows])
    return rows
コード例 #3
0
def get_posts(conf):
    rows = []
    for url in conf['urls']:
        tree = retry_get_tree(url)
        rows = tree.xpath('//div[contains(@id, "question-summary")]')
        rows.extend([process_item_fn(row) for row in rows])
    return rows
コード例 #4
0
def get_repo_page(link):
    print(link, 1)
    tree = retry_get_tree(link)
    stars = tree.xpath(
        '//a[@class="social-count js-social-count"]')[0].text.strip().replace(',', '')
    desc = tree.xpath('//article//p')
    return {'likes': {'at': datetime.datetime.now().isoformat()[:19], 'n': int(stars)},
            'description2': desc[0].text_content() if desc else ''}
コード例 #5
0
ファイル: twitter.py プロジェクト: elitallman/inthenews.io
def get_posts(conf):
    posts = []
    for handle in conf['twitter_handles']:
        print(handle)
        conf['url'] = 'https://twitter.com/{}'.format(handle)
        tree = retry_get_tree(conf['url'])
        rows = tree.xpath('//li[contains(@class, "js-stream-item")]')
        posts.extend([process_item_fn(row) for row in rows])
    return posts
コード例 #6
0
ファイル: twitter.py プロジェクト: elitallman/inthenews.io
def get_posts(conf):
    posts = []
    for handle in conf['twitter_handles']:
        print(handle)
        conf['url'] = 'https://twitter.com/{}'.format(handle)
        tree = retry_get_tree(conf['url'])
        rows = tree.xpath('//li[contains(@class, "js-stream-item")]')
        posts.extend([process_item_fn(row) for row in rows])
    return posts
コード例 #7
0
def get_repo_page(link):
    print(link, 1)
    tree = retry_get_tree(link)
    stars = tree.xpath(
        '//a[@class="social-count js-social-count"]')[0].text.strip().replace(
            ',', '')
    desc = tree.xpath('//article//p')
    return {
        'likes': {
            'at': datetime.datetime.now().isoformat()[:19],
            'n': int(stars)
        },
        'description2': desc[0].text_content() if desc else ''
    }
コード例 #8
0
def get_posts(conf):
    tree = retry_get_tree(conf['url'])
    rows = tree.xpath('//div[contains(@id, "question-summary")]')
    rows = [process_item_fn(row) for row in rows]
    return rows
コード例 #9
0
def get_posts(conf):
    tree = retry_get_tree(conf['url'])
    rows = tree.xpath('//li[@class="repo-list-item"]')
    rows = [process_item_fn(row) for row in rows]
    return rows
コード例 #10
0
ファイル: reddit.py プロジェクト: elitallman/inthenews.io
def get_posts(conf):
    tree = retry_get_tree(conf['url'])
    rows = tree.xpath('//div[@id="siteTable"]/div')
    rows = [process_item_fn(row) for row in rows]
    return rows
コード例 #11
0
def get_posts(conf):
    tree = retry_get_tree(conf['url'])
    rows = tree.xpath('//li[@class="repo-list-item"]')
    rows = [process_item_fn(row) for row in rows]
    return rows
コード例 #12
0
def get_posts(conf):
    tree = retry_get_tree(conf['url'])
    rows = tree.xpath('//div[contains(@id, "question-summary")]')
    rows = [process_item_fn(row) for row in rows]
    return rows
コード例 #13
0
ファイル: reddit.py プロジェクト: elitallman/inthenews.io
def get_posts(conf):
    tree = retry_get_tree(conf["url"])
    rows = tree.xpath('//div[@id="siteTable"]/div')
    rows = [process_item_fn(row) for row in rows]
    return rows