Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Maják
Commits
37ad50b5
Commit
37ad50b5
authored
1 year ago
by
Tomáš Valenta
Browse files
Options
Downloads
Patches
Plain Diff
cut off after 255 characters, remove last settings reference
parent
0e601209
No related branches found
No related tags found
2 merge requests
!804
Release
,
!795
Cut off after 255 characters, remove last old settings reference
Pipeline
#13715
passed
1 year ago
Stage: build
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
instagram_utils/management/commands/update_instagram.py
+1
-4
1 addition, 4 deletions
instagram_utils/management/commands/update_instagram.py
instagram_utils/services.py
+14
-3
14 additions, 3 deletions
instagram_utils/services.py
with
15 additions
and
7 deletions
instagram_utils/management/commands/update_instagram.py
+
1
−
4
View file @
37ad50b5
...
...
@@ -6,10 +6,7 @@ from ...services import InstagramDownloadService
class
Command
(
BaseCommand
):
def
handle
(
self
,
*
args
,
**
options
):
service
=
InstagramDownloadService
(
app_id
=
settings
.
INSTAGRAM_APP_ID
,
app_secret
=
settings
.
INSTAGRAM_APP_SECRET
,
)
service
=
InstagramDownloadService
()
service
.
perform_update
()
self
.
stdout
.
write
(
"
\n
Instagram post update finished.
"
)
This diff is collapsed.
Click to expand it.
instagram_utils/services.py
+
14
−
3
View file @
37ad50b5
...
...
@@ -46,7 +46,15 @@ class InstagramDownloadService:
profile
=
instaloader
.
Profile
.
from_username
(
loader
.
context
,
username
)
post_position
=
0
for
remote_post
in
profile
.
get_posts
():
if
post_position
==
64
:
# Don't go past 64 saved posts
return
post_position
+=
1
if
remote_post
.
is_video
:
logger
.
info
(
"
Instagram post ID %s is a video, skipping.
"
,
remote_post
.
shortcode
...
...
@@ -61,12 +69,17 @@ class InstagramDownloadService:
continue
caption
=
remote_post
.
caption
if
len
(
caption
)
>
255
:
caption
=
caption
[:
255
]
+
"
...
"
local_post_instance
=
InstagramPost
(
remote_id
=
remote_post
.
shortcode
,
author_name
=
profile
.
full_name
,
author_username
=
profile
.
username
,
timestamp
=
remote_post
.
date_local
,
caption
=
remote_post
.
caption
,
caption
=
caption
,
url
=
f
"
https://instagram.com/p/
{
remote_post
.
shortcode
}
"
,
)
...
...
@@ -82,8 +95,6 @@ class InstagramDownloadService:
remote_post
.
shortcode
,
)
post_position
+=
1
def
perform_update
(
self
)
->
None
:
for
username
in
self
.
get_usernames
():
self
.
parse_media_for_user
(
username
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment