Skip to content

Commit

Permalink
change input structure
Browse files Browse the repository at this point in the history
  • Loading branch information
levent91 committed Oct 8, 2021
1 parent f207f76 commit 49f6b69
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 25 deletions.
24 changes: 6 additions & 18 deletions INPUT_SCHEMA.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,27 @@
"editor": "requestListSources",
"sectionCaption": "Direct URLs"
},
"videosFromDate": {
"title": "Videos from",
"type": "string",
"editor": "textfield",
"description": "Scrape the videos from the date e.g <br />30 minutes <br />1 week <br />5 months <br />4 years, etc.<br />for 'Earliest' empty the field",
"pattern": "^(today|yesterday|\\d+\\s?(minute|second|day|hour|month|year|week)s?|\\d{4}\\-\\d{2}\\-\\d{2}(\\s\\d{2}\\:\\d{2}\\:\\d{2})?)$",
"minLength": 0,
"maxLength": 16,
"nullable": true,
"sectionCaption": "Videos from:"
},
"videosToDate": {
"title": "Videos till",
"postsToDate": {
"title": "Videos to",
"type": "string",
"editor": "textfield",
"description": "Scrape the videos until the date e.g <br />30 minutes <br />1 week <br />5 months <br />4 years, etc.<br />for 'Today' empty the field",
"pattern": "^(today|yesterday|\\d+\\s?(minute|second|day|hour|month|year|week)s?|\\d{4}\\-\\d{2}\\-\\d{2}(\\s\\d{2}\\:\\d{2}\\:\\d{2})?)$",
"minLength": 0,
"maxLength": 16,
"nullable": true,
"sectionCaption": "Videos until:"
"sectionCaption": "Videos to:"
},
"postsFromDate": {
"title": "Videos till",
"title": "Videos from",
"type": "string",
"editor": "textfield",
"description": "How far back in history to go e.g <br />30 minutes <br />1 week <br />5 months <br />4 years, etc.<br />for 'No limits' empty the field",
"pattern": "(^(1|([^0a-zA-Z ][0-9]{0,3})) (minute|hour|day|week|month|year))s?",
"pattern": "^(today|yesterday|\\d+\\s?(minute|second|day|hour|month|year|week)s?|\\d{4}\\-\\d{2}\\-\\d{2}(\\s\\d{2}\\:\\d{2}\\:\\d{2})?)$",
"minLength": 0,
"maxLength": 16,
"prefill": "5 years",
"nullable": true,
"sectionCaption": "Time frame"
"sectionCaption": "Videos from:"
},
"downloadSubtitles": {
"title" : "Download subtitles",
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ This actor recognizes the following input fields:
| ----- | ---- | ----------- |
| searchKeywords | String | (optional) Query to search Youtube for |
| maxResults | Integer | (optional) How many videos should be loaded from each search or channel, default is 50 |
| postsFromDate | String | (optional) How far back in history to go, default is "5 years ago". You can also use *minutes*,*hours*,*days*,*weeks* and *months* |
| postsToDate | String | (optional) How far back in history to go, default is "5 years ago". You can also use *minutes*,*hours*,*days*,*weeks* and *months* |
| postsFromDate | String | (optional) How far back in history to go, leave empty to go to the earliest date. You can also use *minutes*,*hours*,*days*,*weeks* and *months* |
| startUrls | String | (optional) Starting Youtube URLs, you can provide search, channel or videos urls |
| proxyConfiguration | Object | Proxy configuration |
| verboseLog | Boolean | Whether to turn on verbose logging |
Expand All @@ -42,9 +43,8 @@ This solution requires the use of **Proxy servers**, either your own proxy serve
{
"searchKeywords": "Terminator dark fate",
"maxResults": 30,
"videosFromDate": "2 years",
"videosToDate": "2021-09-24",
"postsFromDate": "2 weeks ago",
"postsToDate": "2 days",
"postsFromDate": "2 weeks",
"startUrls": [{
"url": "https://www.youtube.com/channel/UC8w/videos" // channel videos
}, {
Expand Down
5 changes: 2 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ Apify.main(async () => {
proxyConfiguration,
searchKeywords,
maxResults,
videosFromDate,
videosToDate,
postsFromDate,
postsToDate,
handlePageTimeoutSecs = 3600,
downloadSubtitles = false,
saveSubsToKVS: saveSubtitlesToKVS = false,
Expand All @@ -31,7 +30,7 @@ Apify.main(async () => {
log.setLevel(log.LEVELS.DEBUG);
}

const minMaxDate = utils.minMaxDates({ min: videosFromDate , max: videosToDate });
const minMaxDate = utils.minMaxDates({ min: postsFromDate , max: postsToDate });
const kvStore = await Apify.openKeyValueStore();
const requestQueue = await Apify.openRequestQueue();
const proxyConfig = await utils.proxyConfiguration({
Expand Down

0 comments on commit 49f6b69

Please sign in to comment.