L
L
LAZERPOPE2020-08-06 17:54:30
YouTube
LAZERPOPE, 2020-08-06 17:54:30

How to download 18+ videos from Youtube using youtube-dl?

The script copes with loading regular videos, but when it sees the 18+ tag, it throws an error.
As I understand it, the problem is that I can't log in even though the login/password is correct.
An attempt to attach a cookie file from my Firefox was also unsuccessful.

const youtubedl = require('youtube-dl')

let cookiesPath = '--cookies \"c:\\Users\\Max\\Documents\\GitHub\\test\\cookies.txt\"'
const url = 'https://www.youtube.com/watch?v=UMRNfWSwmPo'

youtubedl.exec(url, ['--format=18', '-u fakeLogin', '-p fakePass', cookiesPath], 
{}, function (err, output) {
  if (err) throw err;

  console.log(output.join('\n'))
})


Part of the cookies.txt file
spoiler
# Netscape HTTP Cookie File

.google.com TRUE / FALSE 1659792733 SID 0Ad-0yUQJyR5Z2geLibavJnJGjJyvzTkHED7LyhyvhUCZbcB9FwOi4lzK5EA3U9jnoOL_g.
.google.com TRUE / TRUE 1659792733 __Secure-3PSID 0Ad-0yUQJyR5Z2geLibavJnJGjJyvzTkHED7LyhyvhUCZbcB5Wi_OioDdHYGEt3tsUnN1A.
.google.com TRUE / FALSE 1659792733 HSID AKdQn-Q-lvqQ2VQzn
.google.com TRUE / TRUE 1659792733 SSID AWCnEgCyvWNnUokJc
.google.com TRUE / FALSE 1659792733 APISID sCByF_IynYleVvvU/AAKB9D5RbjDHHMxnH
.google.com TRUE / TRUE 1659792733 SAPISID 4aXK2QZW4WnZpfwM/A5RNY7Ahc5K342Knj
.google.com TRUE / TRUE 1659792733 __Secure-3PAPISID 4aXK2QZW4WnZpfwM/A5RNY7Ahc5K342Knj
.google.com TRUE / TRUE 1612531933 NID 204=R_XEkLrT7N3pkJk19_pZw12dX1IhZ3iMEbzogsFHpRw0_snpNr1hpARYdXWV5sv3kXVMgGxI8qoMom2VdGBu7pJkljaizFSN3HdwYmRkPnKwbchRRoY1-IQJ4-u3r7Qi0XV3w2qPKfOJSVGAMp8ms4bYb99IEs1W1Y1JLm3rmmU
.google.com TRUE / TRUE 2146723199 CONSENT YES+RU.ru+20170806-09-0
accounts.google.com FALSE / TRUE 1659792733 ACCOUNT_CHOOSER AFx_qI44ecCh9ilhkj0Bsdytgd2JZKcIAoFtsOppHKlJppoxE0wmMOLStLENGJuSYT3hjlduHbnnjhOpvsa2HJuC5D-KcuG1lHcVl0lJRaj9kFnuEhF4hdO-GvCYSFaP2ZOlh3m009AWKl6Jp4jv7I4uMpbxFiEh6tq3CC7rR-JEQ4rAFLQWyAA
accounts.google.com FALSE / TRUE 1659792962 GAPS 1:XLoATW70DuVmWGRWyaekmBNGKKP4sBOMoItWiDJI68qCWC96jjzedNJUjg90VvpvnES9DQZX0FRGrNET_YvO8MaORmzBtw:XLRG_HFPERL6M9zF
accounts.google.com FALSE / TRUE 1659792962 __Host-GAPS 1:XLoATW70DuVmWGRWyaekmBNGKKP4sBOMoItWiDJI68qCWC96jjzedNJUjg90VvpvnES9DQZX0FRGrNET_YvO8MaORmzBtw:XLRG_HFPERL6M9zF
accounts.google.com FALSE / TRUE 1659792963 LSID doritos|s.RU|s.youtube:0Ad-0_qjmdfqD-S8-3dzcOHPxnz2lOAUipf66YfTe2fO6BLt7-uiuXrXQxDUcbmlzFrwpg.
accounts.google.com FALSE / TRUE 1659792963 __Host-3PLSID doritos|s.RU|s.youtube:0Ad-0_qjmdfqD-S8-3dzcOHPxnz2lOAUipf66YfTe2fO6BLtbjJjHR5NDSkmUqPFh6QdCA.
.google.com TRUE / FALSE 1628257009 SIDCC AJi4QfEUpSLy25fW6EcVYhsoMX4VVL1TITj1AZplsIPLCeeUYVpuQTJQv7C_Dn66SAGNjqWu-A
google-analytics.bi.owox.com FALSE / TRUE 1659792983 ouid 3014753848_3477163738
api.mindbox.ru FALSE / TRUE 2147472000 deviceUUID ca9a14e5-d461-420a-8571-578b083c20e6
.dynamicyield.com TRUE / TRUE 0 DYSES 9bd121010105600cac1be18b090433d4
.dynamicyield.com TRUE / TRUE 1633009007 DYID 1666332804321642323
.histrf.ru TRUE / FALSE 1683120957 top100_id t1.6942605.913953573.1596720957331
.histrf.ru TRUE / FALSE 1683120957 last_visit 1596710157337::1596720957337
.histrf.ru TRUE / FALSE 1628256957 _ym_uid 1596720958178024004
.histrf.ru TRUE / FALSE 1628256957 _ym_d 1596720958
.histrf.ru TRUE / FALSE 1596722757 _ym_visorc_20561137 w
.histrf.ru TRUE / FALSE 1596722757 _ym_visorc_54932257 w
.histrf.ru TRUE / FALSE 1596792958 _ym_isad 2
media.flixcar.com FALSE / TRUE 1628257000 sio_t eyJndmlkIjoiZmxpeDVmMmMwNzY4MDAwMDAwLjI5ODQ4MzYyIn0=
addons.mozilla.org FALSE / TRUE 0 taarId 29578bdc7f9628fc8f02fe6eed843f40f536549e741bf134b348dc6f64e83aa4
www.mozilla.org FALSE / FALSE 1596806575 moz-stub-attribution-code c291cmNlPShub3Qgc2V0KSZtZWRpdW09KGRpcmVjdCkmY2FtcGFpZ249KG5vdCBzZXQpJmNvbnRlbnQ9KG5vdCBzZXQpJmV4cGVyaW1lbnQ9KG5vdCBzZXQpJnZhcmlhdGlvbj0obm90IHNldCkmdWE9ZmlyZWZveA..
www.mozilla.org FALSE / FALSE 1596806575 moz-stub-attribution-sig 71112ee23d1d0b5a5757807da4fee120e980324441664ce2f43e11d87826348a
.mozilla.org TRUE / FALSE 1659792940 _ga GA1.2.1045683847.1596720940
.mozilla.org TRUE / FALSE 1596807340 _gid GA1.2.1023001156.1596720940
support.mozilla.org FALSE / TRUE 1599140193 session_id y5aueiaxu2zh4rbd8wua43sfmwt4krp0
.mozilla.org TRUE / FALSE 1596721073 _gat 1
.doubleclick.net TRUE / TRUE 1659792705 IDE AHWqTUmjaMMU_gZ7ounOzE84rhREVCV5yh3qBDbbAenqj9gW8-ZKobP-CmGRiE5C
.youtube.com TRUE / TRUE 0 YSC tsWtLmoyShY
.youtube.com TRUE / TRUE 1612272703 VISITOR_INFO1_LIVE J0KfKvj6rbc
.youtube.com TRUE / FALSE 1596722503 GPS 1
accounts.youtube.com FALSE /accounts FALSE 1596720718 CheckConnectionTempCookie524 973950
.youtube.com TRUE / FALSE 1659792733 SID 0Ad-0yUQJyR5Z2geLibavJnJGjJyvzTkHED7LyhyvhUCZbcB9FwOi4lzK5EA3U9jnoOL_g.
.youtube.com TRUE / TRUE 1659792733 __Secure-3PSID 0Ad-0yUQJyR5Z2geLibavJnJGjJyvzTkHED7LyhyvhUCZbcB5Wi_OioDdHYGEt3tsUnN1A.
.youtube.com TRUE / FALSE 1659792733 HSID AhhjdRMFh0wjSUtJV
.youtube.com TRUE / TRUE 1659792733 SSID A35KFcBCjUadLP1_x
.youtube.com TRUE / FALSE 1659792733 APISID sCByF_IynYleVvvU/AAKB9D5RbjDHHMxnH
.youtube.com TRUE / TRUE 1659792733 SAPISID 4aXK2QZW4WnZpfwM/A5RNY7Ahc5K342Knj
.youtube.com TRUE / TRUE 1659792733 __Secure-3PAPISID 4aXK2QZW4WnZpfwM/A5RNY7Ahc5K342Knj
.youtube.com TRUE / TRUE 2146723199 CONSENT YES+RU.ru+20170806-09-0
.youtube.com TRUE / TRUE 1659792734 LOGIN_INFO AFmmF2swRQIgHRmM1gEHlc_tjdTt--BnHaRbIrtA4zHAum0YGfEVXi4CIQDwelVz1EalwR3QMrrBqZMabq4MBK8zRVt0bHDl_3ZPuw:QUQ3MjNmelZUb2czRDdJeW9WRFlrMVRsaTBEeUM2M1VDMjlRdmZtU3dxcmlFNFdUajlLTExtaU85TVctNlc2LXhOUENvM3NSNldYcURVVTE4S3p5MnRzVjVubzNPTFBkbUpmSzZTVlhfWDRBMll6THBOWFp2OVI4S3pPWmFNQ2JTVDFpMm1IR205R0tZVTFtOHVzRkxfdi1ZRWIyR1BJWjNlQVU2c2VaaGlkZUpBVXllUUJic1NF
.youtube.com TRUE / FALSE 1617758718 PREF al=ru
.youtube.com TRUE / FALSE 1596720756 ST-1ak0pyq csn=YgYsX7DTMsKZyAXAyZe4BQ&itct=CMgBEKQwGAAiEwjdjMqj2IbrAhXKV7IKHVgGAUgyB2F1dG9uYXZI86Go0uW8lr8TmgEFCAMQ-B0%3D
.youtube.com TRUE / FALSE 1596720780 ST-1pgllso csn=bwYsX-axGsyW7ASZkZCIDg&itct=CH8QpDAYCSITCNuFyqnYhusCFVhqmwodn4gG0DIHcmVsYXRlZEic_fO5tMzmja4BmgEFCAEQ-B0%3D
.youtube.com TRUE / FALSE 1596720782 ST-cb2gl2 csn=hwYsX_qaHdGQyAXk-ZOwAQ&itct=CMYBEKQwGAAiEwitnYa12IbrAhUGdrIKHYfLBlMyB2F1dG9uYXZIsoO91snNwoKxAZoBBQgDEPgd
.youtube.com TRUE / FALSE 1596721396 AST MTU5NjcyMDc5Ng==
.youtube.com TRUE / FALSE 1596721396 dkv f677c6933f545250eff5d92159050aa1e3QEAAAAdGxpcGmcBixfMA==
.youtube.com TRUE / FALSE 0 wide 0
.youtube.com TRUE / FALSE 1596720856 ST-z3l6xj csn=rgYsX_jlBszryAW836rgBQ&itct=CMABEKQwGAEiEwiq9rvH2IbrAhUSW7IKHcFwAGxIkPT7lZqhzt9smgEFCAEQ-B0%3D
.youtube.com TRUE / FALSE 1628257095 SIDCC AJi4QfGcW_3OCPQ-YVLwM9ggMfob2KDOx6G0md9R_LdEeKc6wdzqavEqjfBcGA3MVqo_pORcoA
.ok.ru TRUE / FALSE 3744204657 bci 7183129260029452905
.ok.ru TRUE / FALSE 3744204657 _statid f4a59a8f-5a8e-4684-b4f5-4357b13a7113
.ok.ru TRUE / FALSE 0 landref www.citilink.ru
.yandex.md TRUE / FALSE 1604496959 __ym_zz_zz 1596720957906343352095262766322

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question