Example #1
0
def get_feed_item(url, description, user_id):
    if description is None:
        description = ""
    request = urllib.request.Request(
        url, headers={"User-Agent": "Mozila/5.0"})
    client = urllib.request.urlopen(request)
    web_page = BeautifulSoup(client.read(), "html.parser")
    title = web_page.title.string
    item = FeedItem(url, title)
    item.description = description
    item.user_id = user_id
    return item
Example #2
0
def create_feed_item(url, description, user_id, title):
    item = FeedItem(url, title)
    item.description = description
    item.user_id = user_id
    return item