π€
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" | |
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"> | |
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" /> | |
<xsl:template match="/"> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | |
<head> | |
<title><xsl:value-of select="/rss/channel/title" /> RSS Feed</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from decouple import config | |
# Keys | |
CONSUMER_KEY = config('Consumer_Key') | |
CONSUMER_SECRET_KEY = config('Consumer_Secret_Key') | |
ACCESS_TOKEN = config('Access_Token') | |
ACCESS_TOKEN_SECRET = config('Access_Token_Secret') | |
# Authentication | |
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET_KEY) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def follow_back(self, api): | |
''' | |
Following back to those users who are retweeting | |
''' | |
# getting the retweeters of latest tweet | |
latest_tweet_id = (api.user_timeline(count=1)[0]).id | |
retweets_list = api.retweets(latest_tweet_id) | |
user_name_list = [ | |
retweet.user.id for retweet in retweets_list] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tweet(self, text_list, url_list): | |
''' | |
Posting the news in the twitter and logging the data (First news of the list will be posted: One can modify by using random function) | |
''' | |
# removing news already tweeted | |
file_name = "tweets.txt" | |
with open(file_name, "r") as file: | |
tweet_list = file.readlines() | |
tweet_list = [x.strip() for x in tweet_list] | |
for tweet in tweet_list: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParseFeed(): | |
def __init__(self, url): | |
self.feed_url = url | |
def clean(self, html): | |
''' | |
Getting the text from html and doing some cleaning | |
''' | |
soup = BeautifulSoup(html) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = "http://news.google.com/news?q=artificial+intelligence+in+chemistry&hl=en-US&sort=date&gl=US&num=100&output=rss" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importing modules | |
import feedparser | |
from bs4 import BeautifulSoup | |
import tweepy | |
import os | |
import logging | |
import datetime | |
# url for collecting news | |
url = "http://news.google.com/news?q=computational+chemistry&hl=en-US&sort=date&gl=US&num=100&output=rss" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tweepy | |
feedparser | |
decouple | |
bs4 |
NewerOlder