mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-12 13:18:28 +03:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9b831ce03 | ||
|
|
2a773a25e8 | ||
|
|
719645fc2d | ||
|
|
71fcf5a089 | ||
|
|
590d3fe824 |
@@ -179,7 +179,7 @@ The first time you run, you will be prompted to do a authentication with the pho
|
|||||||
|
|
||||||
|
|
||||||
## Running on Google Sheets Feeder (gsheet_feeder)
|
## Running on Google Sheets Feeder (gsheet_feeder)
|
||||||
The `--gseets_feeder.sheet` property is the name of the Google Sheet to check for URLs.
|
The `--gsheet_feeder.sheet` property is the name of the Google Sheet to check for URLs.
|
||||||
This sheet must have been shared with the Google Service account used by `gspread`.
|
This sheet must have been shared with the Google Service account used by `gspread`.
|
||||||
This sheet must also have specific columns (case-insensitive) in the `header` as specified in [Gsheet.configs](src/auto_archiver/utils/gsheet.py). The default names of these columns and their purpose is:
|
This sheet must also have specific columns (case-insensitive) in the `header` as specified in [Gsheet.configs](src/auto_archiver/utils/gsheet.py). The default names of these columns and their purpose is:
|
||||||
|
|
||||||
|
|||||||
@@ -146,8 +146,10 @@ class TelethonArchiver(Archiver):
|
|||||||
logger.debug(f"Empty media found, skipping {str(mp)=}")
|
logger.debug(f"Empty media found, skipping {str(mp)=}")
|
||||||
continue
|
continue
|
||||||
result.add_media(Media(filename))
|
result.add_media(Media(filename))
|
||||||
|
|
||||||
result.set_content(str(post)).set_title(title).set_timestamp(post.date)
|
result.set_title(title).set_timestamp(post.date).set("api_data", post.to_dict())
|
||||||
|
if post.message != title:
|
||||||
|
result.set_content(post.message)
|
||||||
return result.success("telethon")
|
return result.success("telethon")
|
||||||
|
|
||||||
def _get_media_posts_in_group(self, chat, original_post, max_amp=10):
|
def _get_media_posts_in_group(self, chat, original_post, max_amp=10):
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="notification"></div>
|
<div id="notification"></div>
|
||||||
<h2>Archived media for <a href="{{ url }}">{{ url }}</a></h2>
|
<h2>Archived media for <span class="copy">{{ url }}</span> - <a href="{{ url }}">open</a></h2>
|
||||||
{% if title | string | length > 0 %}
|
{% if title | string | length > 0 %}
|
||||||
<p><b>title:</b> '<span class="copy">{{ title }}</span>'</p>
|
<p><b>title:</b> '<span class="copy">{{ title }}</span>'</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class GDriveStorage(Storage):
|
|||||||
else:
|
else:
|
||||||
logger.debug('GD OAuth Token valid')
|
logger.debug('GD OAuth Token valid')
|
||||||
else:
|
else:
|
||||||
gd_service_account = config.service_account
|
gd_service_account = self.service_account
|
||||||
logger.debug(f'Using GD Service Account {gd_service_account}')
|
logger.debug(f'Using GD Service Account {gd_service_account}')
|
||||||
creds = service_account.Credentials.from_service_account_file(gd_service_account, scopes=SCOPES)
|
creds = service_account.Credentials.from_service_account_file(gd_service_account, scopes=SCOPES)
|
||||||
|
|
||||||
@@ -87,15 +87,6 @@ class GDriveStorage(Storage):
|
|||||||
file_id = self._get_id_from_parent_and_name(folder_id, filename)
|
file_id = self._get_id_from_parent_and_name(folder_id, filename)
|
||||||
return f"https://drive.google.com/file/d/{file_id}/view?usp=sharing"
|
return f"https://drive.google.com/file/d/{file_id}/view?usp=sharing"
|
||||||
|
|
||||||
def upload(self, media: Media, **kwargs) -> bool:
|
|
||||||
# override parent so that we can use shutil.copy2 and keep metadata
|
|
||||||
dest = os.path.join(self.save_to, media.key)
|
|
||||||
os.makedirs(os.path.dirname(dest), exist_ok=True)
|
|
||||||
logger.debug(f'[{self.__class__.name}] storing file {media.filename} with key {media.key} to {dest}')
|
|
||||||
res = shutil.copy2(media.filename, dest)
|
|
||||||
logger.info(res)
|
|
||||||
return True
|
|
||||||
|
|
||||||
def upload(self, media: Media, **kwargs) -> bool:
|
def upload(self, media: Media, **kwargs) -> bool:
|
||||||
logger.debug(f'[{self.__class__.name}] storing file {media.filename} with key {media.key}')
|
logger.debug(f'[{self.__class__.name}] storing file {media.filename} with key {media.key}')
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ _MAJOR = "0"
|
|||||||
_MINOR = "8"
|
_MINOR = "8"
|
||||||
# On main and in a nightly release the patch should be one ahead of the last
|
# On main and in a nightly release the patch should be one ahead of the last
|
||||||
# released build.
|
# released build.
|
||||||
_PATCH = "0"
|
_PATCH = "1"
|
||||||
# This is mainly for nightly builds which have the suffix ".dev$DATE". See
|
# This is mainly for nightly builds which have the suffix ".dev$DATE". See
|
||||||
# https://semver.org/#is-v123-a-semantic-version for the semantics.
|
# https://semver.org/#is-v123-a-semantic-version for the semantics.
|
||||||
_SUFFIX = ""
|
_SUFFIX = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user