Skip to content

Commit ceb39f9

Browse files
authoredAug 7, 2023
Remove twitter :( (#83)
* fix: Remove Twitter because it no longer works :( * v0.7.0 * fix: Add mastodon to utils
1 parent 0785f32 commit ceb39f9

12 files changed

+49
-172
lines changed
 

‎CHANGELOG.md

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# CHANGELOG
22

3-
### **0.?.?** (Unreleased)
3+
### **0.7.0** (August 7 2023)
44

5-
- Fixes
6-
- Fixed a bug where the weather provider would not correctly render celsius unit marker
5+
- Fixes
6+
- Fixed a bug where the weather provider would not correctly render celsius unit marker
7+
- Fixed the RSS story provider,
8+
- Improvements
9+
- added a Mastodon story provider (#82)
10+
- Removed the Twitter story provider, which no longer works due to Twitter's API changes
711

812
### **0.6.0** (June 5 2022)
913

1014
- Improvements
11-
1215
- Enable writing a BytesIO object instead of creating a file. Good for cases where you're running goosepaper on unprivileged systems.
13-
1416
- Fixes
1517
- Fixed the old broken weather provider by switching to Open-Meteo.
1618
- No longer builds images on pull-request branches.
@@ -25,37 +27,29 @@
2527
### **0.5.0** (January 14 2022)
2628

2729
- Improvements
28-
2930
- RSS stories now "fall back" gracefully on just rendering the title, if the full body cannot be rendered. This is in contrast with the old behavior, in which the story would not be rendered at all.
3031
- RSS, Reddit, and Twitter story providers now support a `since_days_ago` argument in their `config` dictionaries that enables you to specify how many days ago to start the search for stories. Older stories will not be included.
3132
- Add support for multiple styles, using the `"styles" config option. Options are `"Academy"`, `"FifthAvenue"`, and `"Autumn"`. Previous style (before v0.4.0) was `Autumn`.
32-
3333
- Housekeeping
34-
3534
- Moved the story providers into their own submodule: Note that this may break backward compatibility if you import these directly.
3635

3736
### **0.4.0** (January 13 2022)
3837

3938
> Multiple fixes and improvements
4039
4140
- Fixes
42-
4341
- Changed some document name comparisons to case insensitive (prevent document overwrites, esp. for Windows users)
4442
- Switched upload to require named arguments rather than positional
4543
- Fixes the `limit` arg in the RSS provider, which was being ignored
46-
4744
- Improvements
48-
4945
- Improve typing support
5046
- Added more error handling for file and syntax handling
5147
- Change to using the `VissibleName` attribute in all cases rather than filename
5248
- Added code for upcoming additional sanity checks
5349
- Added more information on how to customize your goospaper in the docs, @kwillno (#54)
5450
- Adds the option to provide a global config (thanks @sedennial! #48)
5551
- Lots of new options to customize the upload and generation process (thanks @sedennial! #48)
56-
5752
- Housekeeping
58-
5953
- Fixes a bunch of flake8 errors and warnings to keep things tidy
6054

6155
### **0.3.1** (April 29 2021)

‎README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
goosepaper is a utility that delivers a daily newspaper to your remarkable tablet. that's cute!
2525

26-
you can include RSS feeds, Twitter feeds, news articles, wikipedia articles-of-the-day, weather, and more. I read it when I wake up so that I can feel anxious without having to get my phone.
26+
you can include RSS feeds, Mastodon feeds, news articles, wikipedia articles-of-the-day, weather, and more. I read it when I wake up so that I can feel anxious without having to get my phone.
2727

2828
## survey
2929

@@ -112,7 +112,7 @@ Check out [this example PDF](https://github.com/j6k4m8/goosepaper/blob/master/do
112112
## existing story providers ([want to write your own?](https://github.com/j6k4m8/goosepaper/blob/master/CONTRIBUTING.md))
113113

114114
- [Wikipedia Top News / Current Events](https://github.com/j6k4m8/goosepaper/blob/master/goosepaper/storyprovider/wikipedia.py)
115-
- [Tweets](https://github.com/j6k4m8/goosepaper/blob/master/goosepaper/storyprovider/twitter.py)
115+
- [Mastodon Toots](https://github.com/j6k4m8/goosepaper/blob/master/goosepaper/storyprovider/mastodon.py)
116116
- [Weather](https://github.com/j6k4m8/goosepaper/blob/master/goosepaper/storyprovider/weather.py). These stories appear in the "ear" of the front page, just like a regular ol' newspaper
117117
- [RSS Feeds](https://github.com/j6k4m8/goosepaper/blob/master/goosepaper/storyprovider/rss.py)
118118
- [Reddit Subreddits](https://github.com/j6k4m8/goosepaper/blob/master/goosepaper/storyprovider/reddit.py)
@@ -135,7 +135,9 @@ I do not think so, but it is a good question!
135135

136136
### may i use this to browse twitter?
137137

138-
yes you may! you can add a list of usernames to the feed generator and it will make a print-ready version of twitter. this is helpful for when you are on twitter on your laptop but wish you had Other Twitter as well, in print form.
138+
~~yes you may! you can add a list of usernames to the feed generator and it will make a print-ready version of twitter. this is helpful for when you are on twitter on your laptop but wish you had Other Twitter as well, in print form.~~
139+
140+
no! twitter has changed and now no one can play nicely with them. sorry! it is sad!
139141

140142
# You May Also Like...
141143

‎docs/Customizing.md

+10-17
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ As an example we give the config delivered as an example `example-config.json`:
1717
"F": true
1818
}
1919
},
20-
{
21-
"provider": "twitter",
22-
"config": {
23-
"usernames": ["axios", "NPR"],
24-
"limit_per": 8
25-
}
26-
},
2720
{
2821
"provider": "wikipedia_current_events",
2922
"config": {}
@@ -91,7 +84,7 @@ For more information on the styles and to see a gallery of the different stylesh
9184

9285
## Stories and StoryProviders
9386

94-
Stories in a Goosepaper are created by a StoryProvider. You can think of a StoryProvider as a "source." So you might have Twitter stories (`TwitterStoryProvider`), some blog posts (`RSSFeedStoryProvider`), etc.
87+
Stories in a Goosepaper are created by a StoryProvider. You can think of a StoryProvider as a "source." So you might have wikipedia stories (`WikipediaCurrentEventsStoryProvider`), some blog posts (`RSSFeedStoryProvider`), etc.
9588

9689
This section aims to be a comprehensive list of all storyproviders and how to configure them.
9790
(This was the case at time of writing.)
@@ -125,7 +118,6 @@ Right now, these are the storyproviders built into this repository:
125118
- [CustomText](#CustomText)
126119
- [Reddit](#Reddit)
127120
- [RSS](#RSS)
128-
- [Twitter](#Twitter)
129121
- [Weather](#Weather)
130122
- [Wikipedia Current Events](#Wikipedia)
131123

@@ -192,21 +184,22 @@ Default limiting value is `5`.
192184
| `limit` | int | 5 | The number of stories to get. |
193185
| `since_days_ago` | int | None | If provided, filter stories by recency. |
194186

195-
### <a name="Twitter">Twitter</a>
187+
### <a name="Mastodon">Mastodon</a>
196188

197189
```json
198-
"provider" : "twitter"
190+
"provider" : "mastodon"
199191
```
200192

201-
Returns tweets from given users.
193+
Returns toots from given users.
202194

203195
#### Parameters:
204196

205-
| Parameter | Type | Default | Description |
206-
| ---------------- | ---------------- | ------- | ----------------------------------------------------------- |
207-
| `usernames` | str or list[str] | None | Twitter usernames to use. Can be a single username or list. |
208-
| `limit` | int | 8 | The number of stories to get. |
209-
| `since_days_ago` | int | None | If provided, filter stories by recency. |
197+
| Parameter | Type | Default | Description |
198+
| ---------------- | ---- | ------- | ----------------------------------------------------- |
199+
| `username` | str | None | Mastodon username to use. |
200+
| `limit` | int | 8 | The number of stories to get. |
201+
| `since_days_ago` | int | None | If provided, filter stories by recency. |
202+
| `server` | str | None | The server to use (e.g., "https://neuromatch.social") |
210203

211204
### <a name="Weather">Weather</a>
212205

‎docs/example_library_usage.py

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from goosepaper.goosepaper import Goosepaper
55
from goosepaper.storyprovider.reddit import RedditHeadlineStoryProvider
66
from goosepaper.storyprovider.rss import RSSFeedStoryProvider
7-
from goosepaper.storyprovider.twitter import MultiTwitterStoryProvider
87
from goosepaper.storyprovider.weather import OpenMeteoWeatherStoryProvider
98
from goosepaper.storyprovider.wikipedia import WikipediaCurrentEventsStoryProvider
109
from goosepaper.upload import upload
@@ -21,7 +20,6 @@
2120
OpenMeteoWeatherStoryProvider(lat=42.3601, lon=-71.0589, F=True),
2221
RSSFeedStoryProvider("https://www.npr.org/feed/", limit=5),
2322
RSSFeedStoryProvider("https://www.statnews.com/feed/", limit=2),
24-
MultiTwitterStoryProvider(["reuters", "bbcWorld", "axios", "NPR"], limit_per=5),
2523
RedditHeadlineStoryProvider("news"),
2624
RedditHeadlineStoryProvider("todayilearned"),
2725
]

‎example-config.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
}
1111
},
1212
{
13-
"provider": "twitter",
13+
"provider": "mastodon",
1414
"config": {
1515
"since_days_ago": 0.5,
16-
"usernames": [
17-
"axios",
18-
"NPR"
19-
],
16+
"username": "jordan",
17+
"server": "https://neuromatch.social",
2018
"limit_per": 8
2119
}
2220
},

‎goosepaper/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .goosepaper import Goosepaper # noqa
22

3-
__version__ = "0.6.0"
3+
__version__ = "0.7.0"

‎goosepaper/storyprovider/test_mastodon.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# neuromatch.social/@jordan.rss
2-
31
from .mastodon import MastodonStoryProvider
42

53

‎goosepaper/storyprovider/twitter.py

-119
This file was deleted.

‎goosepaper/test_utils.py

+20-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,32 @@ def test_clean_text():
2121
def test_construct_story_providers_from_config_dict():
2222
assert construct_story_providers_from_config_dict({}) == []
2323
stories = construct_story_providers_from_config_dict(
24-
{"stories": [{"provider": "twitter", "config": {"usernames": "j6m8"}}]}
24+
{
25+
"stories": [
26+
{
27+
"provider": "mastodon",
28+
"config": {
29+
"server": "https://neuromatch.social",
30+
"username": "j6m8",
31+
"limit": 1,
32+
},
33+
}
34+
]
35+
}
2536
)
2637
assert len(stories) == 1
2738

2839
stories = construct_story_providers_from_config_dict(
2940
{
3041
"stories": [
31-
{"provider": "twitter", "config": {"usernames": ["j6m8"]}},
42+
{
43+
"provider": "mastodon",
44+
"config": {
45+
"server": "https://neuromatch.social",
46+
"username": "j6m8",
47+
"limit": 1,
48+
},
49+
},
3250
{"provider": "reddit", "config": {"subreddit": "worldnews"}},
3351
]
3452
}

‎goosepaper/util.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,19 @@ def load_config_file(filepath: str) -> dict:
5757

5858

5959
def construct_story_providers_from_config_dict(config: dict):
60-
6160
from goosepaper.storyprovider.rss import RSSFeedStoryProvider
62-
from goosepaper.storyprovider.twitter import MultiTwitterStoryProvider
6361
from goosepaper.storyprovider.reddit import RedditHeadlineStoryProvider
62+
from goosepaper.storyprovider.mastodon import MastodonStoryProvider
6463
from goosepaper.storyprovider.storyprovider import CustomTextStoryProvider
6564
from goosepaper.storyprovider.weather import OpenMeteoWeatherStoryProvider
6665
from goosepaper.storyprovider.wikipedia import WikipediaCurrentEventsStoryProvider
6766

6867
StoryProviderConfigNames = {
6968
"lorem": CustomTextStoryProvider,
7069
"text": CustomTextStoryProvider,
71-
"twitter": MultiTwitterStoryProvider,
7270
"reddit": RedditHeadlineStoryProvider,
7371
"weather": OpenMeteoWeatherStoryProvider,
72+
"mastodon": MastodonStoryProvider,
7473
"openmeteo_weather": OpenMeteoWeatherStoryProvider,
7574
"wikipedia_current_events": WikipediaCurrentEventsStoryProvider,
7675
"rss": RSSFeedStoryProvider,

‎requirements.txt

-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ requests
44
# for rss feeds and reddit:
55
feedparser
66

7-
# for twitter stories:
8-
git+https://github.com/twintproject/twint.git@origin/master#egg=twint
9-
pandas
10-
117
# for wikipedia stories:
128
bs4
139
lxml

‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from codecs import open as copen
55
from setuptools import setup, find_packages
66

7-
__version__ = "0.6.0"
7+
__version__ = "0.7.0"
88

99

1010
here = path.abspath(path.dirname(__file__))

0 commit comments

Comments
 (0)
Please sign in to comment.