-
Notifications
You must be signed in to change notification settings - Fork 12
/
phdler.sh
449 lines (392 loc) · 11.6 KB
/
phdler.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
#!/bin/bash
# DEPRECATED 9.11.2019.
version="1.0.7"
### Set default parameters
action=$1
command=$2
stars_file="$HOME/phdler/stars.txt"
stars_file_new="$HOME/phdler/stars-new.txt"
models_file="$HOME/phdler/models.txt"
models_file_new="$HOME/phdler/models-new.txt"
channels_file="$HOME/phdler/channels.txt"
channels_file_new="$HOME/phdler/channels-new.txt"
users_file="$HOME/phdler/users.txt"
users_file_new="$HOME/phdler/users-new.txt"
### Loading config file
source $HOME/phdler/phdler.config
### Start script
if [ "$action" == 'start' ]
then
echo Starting models
while IFS= read -r modellist; do
youtube-dl $ytdlsetts $lastvideos -o $dllocation'/'$modellist'/%(title)s.%(ext)s' 'https://www.pornhub.com/model/'$modellist'/videos/upload'
done <$models_file
echo Starting stars
while IFS= read -r starslist; do
youtube-dl $ytdlsetts $lastvideos -o $dllocation'/'$starslist'/%(title)s.%(ext)s' 'https://www.pornhub.com/pornstar/'$starslist'/videos/upload'
done <$stars_file
echo Starting users
while IFS= read -r userlist; do
youtube-dl $ytdlsetts $lastvideos -o $dllocation'/'$userlist'/%(title)s.%(ext)s' 'https://www.pornhub.com/users/'$userlist'/videos/public'
done <$users_file
echo Starting channels
while IFS= read -r channellist; do
youtube-dl $ytdlsetts $lastvideos -o $dllocation'/'$channellist'/%(title)s.%(ext)s' 'https://www.pornhub.com/channels/'$channellist'/videos'
done <$channels_file
echo Script run `date "+%H:%M:%S %d/%m/%y"` >> $HOME/phdler.log
elif [ "$action" == 'refresh' ]
then
while read model; do
echo Searching for $model
youtube-dl $ytdlsetts -o $dllocation'/'$model'/%(title)s.%(ext)s' 'https://www.pornhub.com/model/'$model'/videos/upload'
if grep -Fxq "$model" $models_file
then
echo "Model exists. Not adding to models.txt"
else
echo $model >> $models_file
echo $model added to models.txt
fi
done <$models_file_new
while read star; do
echo Searching for $star
youtube-dl $ytdlsetts -o $dllocation'/'$star'/%(title)s.%(ext)s' 'https://www.pornhub.com/pornstar/'$star'/videos/upload'
if grep -Fxq "$star" $stars_file
then
echo "Pornstar exists. Not adding to stars.txt"
else
echo $star >> $stars_file
echo $star added to stars.txt
fi
done <$stars_file_new
while read user; do
echo Searching for $user
youtube-dl $ytdlsetts -o $dllocation'/'$user'/%(title)s.%(ext)s' 'https://www.pornhub.com/users/'$user'/videos/public'
if grep -Fxq "$user" $users_file
then
echo "User exists. Not adding to users.txt"
else
echo $user >> $users_file
echo $user added to users.txt
fi
done <$users_file_new
while read channel; do
echo Searching for $channel
youtube-dl $ytdlsetts -o $dllocation'/'$channel'/%(title)s.%(ext)s' 'https://www.pornhub.com/channels/'$channel'/videos'
if grep -Fxq "$channel" $channels_file
then
echo "Channel exists. Not adding to channels.txt"
else
echo $channel >> $channels_file
echo $channel added to channels.txt
fi
done <$channels_file_new
elif [ "$action" == 'custom' ]
then
if [ "$command" == '' ]
then
clear
echo "-----------------"
echo "Please run [phdler custom <ph url>]"
echo "-----------------"
exit 1;
else
youtube-dl $ytdlsetts -o $dllocation'/handpicked/%(title)s.%(ext)s' $command
fi
elif [ "$action" == 'add' ]
then
if [ "$command" == '' ]
then
clear
echo "-----------------"
echo "Please run [phdler add model-name/pornstar-name/user-name/channel-name]"
echo "-----------------"
exit 1;
else
pornstarcheck=$(curl -s --head -w %{http_code} https://www.pornhub.com/pornstar/$command -o /dev/null)
if [ "$pornstarcheck" == '200' ]
then
echo $command is a pornstar.
if grep -Fxq "$command" $stars_file
then
echo Pornstar exists.
exit 1;
else
echo $command >> $stars_file_new
echo "Pornstar added."
echo "---------------"
echo "Please run [phdler refresh] to download new content."
echo "-----------------"
exit 1;
fi
exit 1;
else
echo $command is not a pornstar.
fi
modelcheck=$(curl -s --head -w %{http_code} https://www.pornhub.com/model/$command -o /dev/null)
if [ "$modelcheck" == '200' ]
then
echo $command is a model.
if grep -Fxq "$command" $models_file
then
echo Model exists.
exit 1;
else
echo $command >> $models_file_new
echo "Model added."
echo "---------------"
echo "Please run [phdler refresh] to download new content."
echo "-----------------"
exit 1;
fi
exit 1;
else
echo $command is not a model.
fi
channelcheck=$(curl -s --head -w %{http_code} https://www.pornhub.com/channels/$command -o /dev/null)
if [ "$channelcheck" == '200' ]
then
echo $command is a channel.
if grep -Fxq "$command" $channels_file
then
echo Channel exists.
exit 1;
else
echo $command >> $channels_file_new
echo "Channel added."
echo "---------------"
echo "Please run [phdler refresh] to download new content."
echo "-----------------"
exit 1;
fi
exit 1;
else
echo $command is not a channel.
fi
usercheck=$(curl -s --head -w %{http_code} https://www.pornhub.com/users/$command -o /dev/null)
if [ "$usercheck" == '200' ]
then
echo $command is a user.
if grep -Fxq "$command" $users_file
then
echo User exists.
exit 1;
else
echo $command >> $users_file_new
echo "User added."
echo "-----------------"
echo "Please run [phdler refresh] to download new content."
echo "-----------------"
exit 1;
fi
exit 1;
else
echo $command is not a user.
fi
fi
elif [ "$action" == 'clean' ]
then
if [ "$command" == 'models' ]
then
> $models_file_new
echo "models-new.txt cleaned."
exit 1;
elif [ "$command" == 'pornstars' ]
then
> $stars_file_new
echo "stars-new.txt cleaned."
exit 1;
elif [ "$command" == 'channels' ]
then
> $channels_file_new
echo "channels-new.txt cleaned."
exit 1;
elif [ "$command" == 'users' ]
then
> $users_file_new
echo "users-new.txt cleaned."
exit 1;
elif [ "$command" == 'all' ]
then
> $models_file_new
> $stars_file_new
> $channels_file_new
> $users_file_new
echo "All fresh txts are cleaned."
exit 1;
else
clear
echo "-----------------"
echo "Please run phdler clean with these commands:"
echo "[models | pornstars | channels | users | all]"
echo "-----------------"
exit 1;
fi
elif [ "$action" == 'remove' ]
then
if [ "$command" == 'model' ]
then
clear
echo "Listing of models:"
echo "-----------------"
while IFS= read -r modellist; do
echo $modellist
done <$models_file
echo "-----------------"
read -p 'Write the model name to remove (or type c to cancel): ' modelname
if [ "$modelname" != 'c' ]
then
grep -v "$modelname" $models_file > $HOME/phdler/models2.txt; mv $HOME/phdler/models2.txt $models_file
echo Deleted $modelname
exit 1;
else
echo Canceling operation.
exit 1;
fi
elif [ "$command" == 'pornstar' ]
then
clear
echo "Listing of pornstars:"
echo "-----------------"
while IFS= read -r starslist; do
echo $starslist
done <$stars_file
echo "-----------------"
read -p 'Write the pornstar name to remove (or type c to cancel): ' starname
if [ "$starname" != 'c' ]
then
grep -v "$modelname" $stars_file > $HOME/phdler/stars2.txt; mv $HOME/phdler/stars2.txt $stars_file
echo Deleted $starname
exit 1;
else
echo Canceling operation.
exit 1;
fi
elif [ "$command" == 'channel' ]
then
clear
echo "Listing of channels:"
echo "-----------------"
while IFS= read -r channellist; do
echo $channellist
done <$channels_file
echo "-----------------"
read -p 'Write the channel name to remove (or type c to cancel): ' channelname
if [ "$channelname" != 'c' ]
then
grep -v "$channelname" $channels_file > $HOME/phdler/channels2.txt; mv $HOME/phdler/channels2.txt $channels_file
echo Deleted $channelname
exit 1;
else
echo Canceling operation.
exit 1;
fi
elif [ "$command" == 'user' ]
then
clear
echo "Listing of users:"
echo "-----------------"
while IFS= read -r userlist; do
echo $userlist
done <$users_file
echo "-----------------"
read -p 'Write the user name to remove (or type c to cancel): ' usname
if [ "$usname" != 'c' ]
then
grep -v "$usname" $users_file > $HOME/phdler/users2.txt; mv $HOME/phdler/users2.txt $users_file
echo Deleted $usname
exit 1;
else
echo Canceling operation.
exit 1;
fi
else
echo "-----------------"
echo "Please run phdler remove with these commands:"
echo "[model | pornstar | channel | user]"
echo "-----------------"
exit 1;
fi
elif [ "$action" == 'list' ]
then
if [ "$command" == 'models' ]
then
clear
echo "Listing of models:"
echo "-----------------"
while IFS= read -r modellist; do
echo $modellist
done <$models_file
echo "-----------------"
elif [ "$command" == 'pornstars' ]
then
clear
echo "Listing of pornstars:"
echo "-----------------"
while IFS= read -r starslist; do
echo $starslist
done <$stars_file
echo "-----------------"
elif [ "$command" == 'channels' ]
then
clear
echo "Listing of channels:"
echo "-----------------"
while IFS= read -r channellist; do
echo $channellist
done <$channels_file
echo "-----------------"
elif [ "$command" == 'users' ]
then
clear
echo "Listing of users:"
echo "-----------------"
while IFS= read -r userlist; do
echo $userlist
done <$users_file
echo "-----------------"
else
echo "-----------------"
echo "Please run phdler list with these commands:"
echo "[models | pornstars | channels | users]"
echo "-----------------"
exit 1;
fi
elif [ "$action" == 'config' ]
then
nano $HOME/phdler/phdler.config
exit 1;
elif [ "$action" == 'update' ]
then
sh $HOME/phdler/update.sh
exit 1;
elif [ "$action" == '-h' ]
then
clear
echo "-----------------"
echo "You asked for help, here it comes! Run phdler with these commands:"
echo "-----------------"
echo "start (start the script)"
echo "refresh (run the script and download from the fresh database)"
echo "custom *url* (download a custom URL from PornHub)"
echo "add *model/pornstar/channel/user* (add to fresh database)"
echo "list *models/pornstars/channels/users* (show your database)"
echo "remove *model/pornstar/channel/user* (remove a model or pornstar from the database)"
echo "clean *models/pornstars/channels/users* (clean the -new.txt database)"
echo "config (edit the config file)"
echo "update (update script to the latest version)"
echo "-----------------"
echo "Example: phdler add here-goes-the-model-name"
echo "-----------------"
exit 1;
elif [ "$action" == '-v' ]
then
echo "phdler version: $version"
exit 1;
else
clear
echo "-----------------"
echo "Please run phdler with these commands:"
echo "[start | refresh | custom | add | list | remove | clean | update | config | -h for help | -v for version]"
echo "-----------------"
exit 1;
fi