stockbsd 2019-10-24 16:34:12 +08:00
rodzic a2fd8d52d2
commit d7460a0e10
5 zmienionych plików z 18 dodań i 21 usunięć

Wyświetl plik

@ -9,14 +9,15 @@ pip3 install twitter-dl
```
usage: twitter-dl [-h] [-c CONFIDENTIAL]
[-s {large,medium,small,thumb,orig}]
[--tweet] [--video] [--nophoto]
[--video] [--nophoto]
[-l LIMIT] [--rts]
[--thread-number THREAD_NUMBER]
[--coro-number CORO_NUMBER]
[--since SID]
[--tweet] [--list]
resource_id dest
Download all images uploaded by a twitter user you specify
Download all images and/or videos uploaded by a twitter user you specify
positional arguments:
resource_id An ID of a twitter user. Also accept tweet url or
@ -29,14 +30,14 @@ optional arguments:
a json file containing a key and a secret
-s {large,medium,small,thumb,orig}, --size {large,medium,small,thumb,orig}
specify the size of images
--tweet indicate you gived a tweet url or tweet id
--tweet indicate resource_id is a numbered tweet id
--list indicate resource_id is a list (user:slug)
--video include video
--nophoto exclude photo
-l LIMIT, --limit LIMIT
the maximum number of tweets to check (most recent
first)
the maximum number of tweets to check (most recent first)
--rts save images contained in retweets
--thread-number THREAD_NUMBER
--coro-number CORO_NUMBER
--since SID
--thread-number THREAD_NUMBER
--coro-number CORO_NUMBER
--since SID
```

Wyświetl plik

@ -18,11 +18,10 @@ def get_version():
return version
raise RuntimeError("Unable to find version string in %s" % version_file)
name = "twitter-dl"
git_repo = "https://github.com/stockbsd/{}".format(name)
git_repo = "https://github.com/stockbsd/twitter-media-dl"
setup(
name=name,
name="twitter-dl", #distribution name
version=get_version(),
description="Download tweet images and videos",
long_description=Readme,
@ -37,7 +36,7 @@ setup(
url=git_repo,
author="stockbsd",
author_email="stockbsd@gmail.com",
keywords="twitter",
keywords="twitter, asyncio, media",
project_urls={"Bug Reports": git_repo, "Source": git_repo},
classifiers=[
"Programming Language :: Python :: 3",

Wyświetl plik

@ -1,3 +1,3 @@
from .downloader import Downloader
version = "0.1.3"
version = "0.1.4"

Wyświetl plik

@ -1,11 +1,9 @@
import os
import argparse
import json
import re
import logging
from . import Downloader
from .exceptions import *
def main():
@ -36,13 +34,13 @@ def main():
)
parser.add_argument(
"--tweet",
help="indicate you gived a tweet url or tweet id",
help="indicate you gived a tweet id",
default=False,
action="store_true",
)
parser.add_argument(
"--list",
help="indicate you gived a list by user:list",
help="indicate you gived a list by user:slug",
default=False,
action="store_true",
)
@ -76,11 +74,11 @@ def main():
with open(args.confidential) as f:
confidential = json.loads(f.read())
if "consumer_key" not in confidential or "consumer_secret" not in confidential:
raise ConfidentialsNotSuppliedError()
raise RuntimeError("Confidentials Not Supplied")
api_key = confidential["consumer_key"]
api_secret = confidential["consumer_secret"]
else:
raise ConfidentialsNotSuppliedError(args.confidential)
raise RuntimeError("Confidentials Not Supplied")
downloader = Downloader(api_key, api_secret, args.thread_number, args.coro_number)

Wyświetl plik

@ -6,7 +6,6 @@ import json
import requests
from .exceptions import *
from .threaded_aio_dlder import AioDownloader
@ -50,7 +49,7 @@ class Downloader:
if r.status_code == 200:
return r.json()["access_token"]
else:
raise BearerTokenNotFetchedError()
raise RuntimeError("Bearer TokenNot Fetched")
def download_media_of_tweet(self, tid, save_dest, size="large", include_video=False,
include_photo=True):