Skip to content

Commit 5488037

Browse files
committed
feat: trends #234
1 parent 3e30c37 commit 5488037

File tree

10 files changed

+683
-53
lines changed

10 files changed

+683
-53
lines changed

Dockerfile.sq-matrix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
FROM python:3.10-alpine AS base
1+
FROM python:3.10-alpine
22
RUN apk add build-base
33

4-
FROM base
54
ARG SQLY=2021
65
ARG SQLV=3340100
76

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ test-sq:
3333
@docker -l warning build -f Dockerfile.sq-matrix --build-arg SQLY=$(y) --build-arg SQLV=$(v) -t $(name) .
3434
@docker run $(name)
3535

36-
test-py-matrix:
36+
test-matrix-py:
3737
@make test-py v=3.10
3838
@make test-py v=3.11
3939
@make test-py v=3.12
4040
@make test-py v=3.13
4141

42-
test-sq-matrix:
42+
test-matrix-sq:
4343
@# https://www.sqlite.org/chronology.html
4444
@make test-sq y=2018 v=3240000
4545
@make test-sq y=2019 v=3270200
@@ -66,3 +66,4 @@ update-mocks:
6666
twscrape user_media --raw --limit 10 2244994945 | jq > ./tests/mocked-data/raw_user_media.json
6767
twscrape search --raw --limit 5 "elon musk lang:en" | jq > ./tests/mocked-data/raw_search.json
6868
twscrape list_timeline --raw --limit 10 1494877848087187461 | jq > ./tests/mocked-data/raw_list_timeline.json
69+
twscrape trends --raw sport | jq > ./tests/mocked-data/raw_trends.json

readme.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,12 @@ async def main():
9292
await gather(api.user_media(user_id, limit=20)) # list[Tweet]
9393

9494
# list info
95-
list_id = 123456789
96-
await gather(api.list_timeline(list_id))
95+
await gather(api.list_timeline(list_id=123456789))
96+
97+
# trends
98+
await gather(api.trends("news")) # list[Trend]
99+
await gather(api.trends("sport")) # list[Trend]
100+
await gather(api.trends("VGltZWxpbmU6DAC2CwABAAAACHRyZW5kaW5nAAA")) # list[Trend]
97101

98102
# NOTE 1: gather is a helper function to receive all data as list, FOR can be used as well:
99103
async for tweet in api.search("elon musk"):
@@ -244,6 +248,7 @@ twscrape verified_followers USER_ID --limit=20
244248
twscrape subscriptions USER_ID --limit=20
245249
twscrape user_tweets USER_ID --limit=20
246250
twscrape user_tweets_and_replies USER_ID --limit=20
251+
twscrape trends sport
247252
```
248253

249254
The default output is in the console (stdout), one document per line. So it can be redirected to the file.

0 commit comments

Comments
 (0)