コード例 #1
0
def scrapeMessages(topicID, pageNum):
    """Scrape all messages on the specified topic, page combination."""
    """CAVEAT: Messages are not memoized."""
    offset = (pageNum - 1) * 20
    html = bitcointalk.requestTopicPage(topicID, offset)
    # _saveToFile(html, "topicpage", "{0}.{1}".format(topicId, offset))
    data = bitcointalk.parseTopicPage(html)
    data = data['messages']
    pg.insertMessages(data)
    return data
コード例 #2
0
def scrapeMessages(topicId, pageNum):
    """Scrape all messages on the specified topic, page combination."""
    """CAVEAT: Messages are not memoized."""
    offset = (pageNum-1)*20
    html = bitcointalk.requestTopicPage(topicId, offset)
    _saveToFile(html, "topicpage", "{0}.{1}".format(topicId, offset))
    data = bitcointalk.parseTopicPage(html)
    data = data['messages']
    pg.insertMessages(data)
    return data
コード例 #3
0
def scrapeTopic(topicID):
    """Scrape information on the specified topic."""
    html = bitcointalk.requestTopicPageAll(topicID)
    data = bitcointalk.parseTopicPage(html)
    messages = data.pop('messages')
    pg.insertMessages(messages)

    if topicID not in memo["topics"]:
        pg.insertTopic(data)
        memo["topics"].add(topicID)

    return data
コード例 #4
0
def _insertTopicPage(data):
    """Insert data as topic and messages and splice off messages."""
    pg.insertMessages(data.pop("messages"))
    pg.insertTopic(data)
コード例 #5
0
def _insertTopicPage(data):
    """Insert data as topic and messages and splice off messages."""
    pg.insertMessages(data.pop('messages'))
    pg.insertTopic(data)