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
9d515f09
Commit
9d515f09
authored
Nov 20, 2021
by
soheib
Browse files
update service
parent
c67101f4
Changes
6
Hide whitespace changes
Inline
Side-by-side
package-lock.json
View file @
9d515f09
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/instagram/instagram.service.ts
View file @
9d515f09
...
...
@@ -125,12 +125,16 @@ export class InstagramService implements OnApplicationBootstrap {
async
addStoryData
(
addDto
:
AddStoryDataDto
)
{
for
await
(
const
userData
of
addDto
.
story_mentions
)
{
let
foundUser
=
await
this
.
userModel
.
findOne
({
username
:
userData
.
username
})
if
(
foundUser
)
{
let
foundData
=
await
this
.
storyMentionModel
.
findOne
({
user_id
:
new
Types
.
ObjectId
(
foundUser
.
_id
)
})
if
(
!
foundData
)
{
console
.
log
(
'
3
'
);
await
this
.
storyMentionModel
.
create
({
_id
:
new
Types
.
ObjectId
(),
user_id
:
foundUser
.
_id
,
...
...
@@ -138,6 +142,8 @@ export class InstagramService implements OnApplicationBootstrap {
})
}
else
{
console
.
log
(
'
2
'
);
await
this
.
storyMentionModel
.
findOneAndUpdate
({
user_id
:
new
Types
.
ObjectId
(
foundUser
.
_id
),
},
{
count
:
userData
.
count
})
...
...
@@ -149,6 +155,8 @@ export class InstagramService implements OnApplicationBootstrap {
username
:
userData
.
username
,
is_follower
:
false
})
console
.
log
(
'
1
'
);
await
this
.
storyMentionModel
.
create
({
_id
:
new
Types
.
ObjectId
(),
user_id
:
newUser
.
_id
,
...
...
src/instagram/instaloader-service/getComments.py
View file @
9d515f09
...
...
@@ -2,14 +2,12 @@ import instaloader
import
pymongo
import
sys
username
=
str
(
sys
.
argv
[
1
])
password
=
str
(
sys
.
argv
[
2
])
mongo_connection_string
=
"mongodb://instagram:wcD3B5sGw0yQ@185.231.180.248:27017/instagram-lottry?authSource=admin&authMechanism=SCRAM-SHA-256"
# mongo_connection_string = "mongodb://localhost:27017/?serverSelectionTimeoutMS=5000&connectTimeoutMS=10000"
username
=
"soheib693"
password
=
"kaka1374"
mongo_connection_string
=
"mongodb://localhost:27017/insta-lottery"
database_name
=
"instagram-lottry"
post_short_code
=
str
(
sys
.
argv
[
3
])
PROFILE
=
str
(
sys
.
argv
[
4
])
post_short_code
=
"CWbEz7DA2LU"
PROFILE
=
"azadi.gold"
def
__main__
():
...
...
src/instagram/instaloader-service/getFollowers.py
View file @
9d515f09
...
...
@@ -2,11 +2,11 @@ import instaloader
import
pymongo
import
sys
username
=
str
(
sys
.
argv
[
1
])
password
=
str
(
sys
.
argv
[
2
])
username
=
"soheib.md"
password
=
"soheib7701mohammadi"
mongo_connection_string
=
"mongodb://instagram:wcD3B5sGw0yQ@185.231.180.248:27017/instagram-lottry?authSource=admin&authMechanism=SCRAM-SHA-256"
database_name
=
"instagram-lottry"
PROFILE
=
str
(
sys
.
argv
[
3
])
PROFILE
=
"azadi.gold"
def
__main__
():
...
...
src/instagram/instaloader-service/getLikes.py
View file @
9d515f09
...
...
@@ -3,17 +3,16 @@ import pymongo
import
sys
username
=
str
(
sys
.
argv
[
1
])
password
=
str
(
sys
.
argv
[
2
])
mongo_connection_string
=
"mongodb://instagram:wcD3B5sGw0yQ@185.231.180.248:27017/instagram-lottry?authSource=admin&authMechanism=SCRAM-SHA-256"
# mongo_connection_string = "mongodb://localhost:27017/?serverSelectionTimeoutMS=5000&connectTimeoutMS=10000"
username
=
"soheib693"
password
=
"kaka1374"
mongo_connection_string
=
"mongodb://localhost:27017/insta-lottery"
database_name
=
"instagram-lottry"
post_short_code
=
str
(
sys
.
argv
[
3
])
PROFILE
=
str
(
sys
.
argv
[
4
])
post_short_code
=
"CWbEz7DA2LU"
PROFILE
=
"azadi.gold"
def
__main__
():
print
(
sys
.
argv
[
1
],
sys
.
argv
[
2
],
sys
.
argv
[
3
],
sys
.
argv
[
4
])
#
print(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
print
(
"connecting to the instagram ...."
)
L
=
instaloader
.
Instaloader
()
L
.
login
(
username
,
password
)
...
...
src/lottery/lottery.service.ts
View file @
9d515f09
...
...
@@ -101,6 +101,7 @@ export class LotteryService {
}
async
changeStatus
(
changeStatus
:
ChangeStatusDto
)
{
let
perviosWinners
=
await
this
.
perviosWinners
()
const
foundUser
=
await
this
.
userModel
.
findOne
({
username
:
{
$regex
:
changeStatus
.
username
.
trim
(),
...
...
@@ -115,9 +116,17 @@ export class LotteryService {
const
foundLottryResults
=
await
this
.
lotteryResultModel
.
find
({
user_id
:
foundUser
.
_id
,
})
for
await
(
const
result
of
foundLottryResults
)
{
result
.
status
=
'
online
'
await
result
.
save
()
if
(
perviosWinners
.
includes
(
foundUser
.
username
))
{
for
await
(
const
result
of
foundLottryResults
)
{
result
.
status
=
'
winner before
'
await
result
.
save
()
}
}
else
{
for
await
(
const
result
of
foundLottryResults
)
{
result
.
status
=
'
online
'
await
result
.
save
()
}
}
await
this
.
userModel
.
findOneAndUpdate
(
{
username
:
changeStatus
.
username
},
...
...
@@ -166,6 +175,18 @@ export class LotteryService {
return
await
this
.
postModel
.
distinct
(
'
url
'
)
as
string
[]
}
perviosWinners
()
{
return
[
"
massi_a_6363
"
,
"
atefeh.akheraty
"
,
"
rokni_mohsen
"
,
"
somayeh_14552103
"
,
"
solmaz_sph
"
,
"
vida_boronz
"
,
"
saber.khazai
"
,
"
shaghayegh.h98
"
,
"
meli_giiz
"
,
"
cakekhanegilarisa
"
,
"
nasrin_abdollahzade
"
,
"
nahid_az2665
"
,
"
seda.asna
"
,
"
malyh59
"
,
"
elham_el5
"
,
"
n_a_z_n_i_n5678
"
,
"
khyosh_tip_50
"
,
"
sobh.an3794
"
,
"
mahla.azkia
"
,
"
nargeschegini1390
"
,
"
nedaashh
"
,
"
farhadeghbali0
"
,
"
taha138021
"
,
"
mehrii__mhmdamani
"
,
"
paeiiiz_90
"
,
"
saha.rghadimkhani
"
,
"
h.a.h.a9090
"
,
"
soma_yeh_1455
"
,
"
alireza411212
"
,
"
sadra.mahmoodi.007666
"
,
"
morteza.naghikhani
"
,
"
mhtb_1279
"
,
"
nasim..1221
"
,
"
sakineeketabii
"
,
"
negari.z.n
"
,
"
fffff.a.t.e.me.h
"
,
"
toktam.yobi80
"
,
"
0o0_asna0o0
"
,
"
soma.ye2103
"
,
"
leil_a658
"
,
"
elahi2328
"
]
}
@
Cron
(
CronExpression
.
EVERY_3_HOURS
)
async
cronCalculateScore
()
{
console
.
log
(
'
start cron ======> calculate daily score
'
)
...
...
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