Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
shahriar
instagram-service
Commits
65edba38
Commit
65edba38
authored
Aug 01, 2021
by
shahriar
☹
Browse files
Update comment.py
parent
d7b987ff
Pipeline
#362
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
comment.py
0 → 100644
View file @
65edba38
import
instaloader
import
pymongo
from
datetime
import
timezone
L
=
instaloader
.
Instaloader
()
L
.
login
(
'shahriarvelayat'
,
'shve8864@@'
)
post
=
instaloader
.
Post
.
from_shortcode
(
L
.
context
,
'CRWNkkchs2x'
)
client
=
pymongo
.
MongoClient
(
"*******************************************"
)
db
=
client
[
"instagram-lottry"
]
col
=
db
[
"comments"
]
comments_from_loop_including_answers
=
[]
for
comment
in
post
.
get_comments
():
print
(
"Searching : "
,
comment
.
id
)
search
=
col
.
find_one
({
"comment_id"
:
comment
.
id
})
try
:
if
search
is
not
None
and
search
[
"comment_id"
]:
print
(
comment
.
id
,
" Already Exist"
)
else
:
temp
=
{
"comment_id"
:
comment
.
id
,
"owner_username"
:
comment
.
owner
.
username
,
"owner_id"
:
comment
.
owner
.
userid
,
"text"
:
comment
.
text
,
"date"
:
comment
.
created_at_utc
.
timestamp
()}
x
=
col
.
update
(
temp
,
temp
,
upsert
=
True
)
print
(
comment
.
id
,
" added"
)
except
:
print
(
""
)
# x = col.insert_one({"comment_id":comment.id ,"owner_username" : comment.owner.username ,
# "owner_id":comment.owner.userid, "text":comment.text , "date" : comment.created_at_utc.timestamp() })
# comments_from_loop_including_answers.append(comment)
print
(
len
(
comments_from_loop_including_answers
))
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment