Exemple #1
0
def create_tweets(sender, instance, created, **kwargs):
    """Create a news items from source"""
    #if created:
    classifier = BayesianClassifier()
    url = "feed://search.twitter.com/search.atom?q=" + instance.search
    feed = feedparser.parse(url)
    for item in feed.entries:
        news = Tweet(text=item.summary)
        news.save()
Exemple #2
0
def create_tweets(sender, instance, created, **kwargs):
    """Create a news items from source"""
    #if created:
    classifier = BayesianClassifier()
    url = "feed://search.twitter.com/search.atom?q=" + instance.search
    feed = feedparser.parse(url)
    for item in feed.entries:
        news = Tweet(text=item.summary)
        news.save()
Exemple #3
0
def create_news_items(sender, instance, created, **kwargs):
    """Create a news items from source"""
    #if created:
    feed = feedparser.parse(instance.url)
    for item in feed.entries:
        try:
            news = News.objects.get(url=item.link)
        except News.DoesNotExist:
            if not hasattr(item, 'updated_parsed'):
                date = datetime.datetime.now()
            else:
                date = datetime.datetime(*item.updated_parsed[:6])
            news = News(url=item.link, title=item.title, body=strip_tags(item.summary),
                        date=date, source=instance)
            news.save()
Exemple #4
0
def create_news_items(sender, instance, created, **kwargs):
    """Create a news items from source"""
    #if created:
    feed = feedparser.parse(instance.url)
    for item in feed.entries:
        try:
            news = News.objects.get(url=item.link)
        except News.DoesNotExist:
            if not hasattr(item, 'updated_parsed'):
                date = datetime.datetime.now()
            else:
                date = datetime.datetime(*item.updated_parsed[:6])
            news = News(url=item.link,
                        title=item.title,
                        body=strip_tags(item.summary),
                        date=date,
                        source=instance)
            news.save()