Scrips does not accept video ID starting with a hyphen

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have tried two separate scripts for scrapping all comments of a Youtube video.
Everything works fine, but there was one problem:Youtube video ID's starting with a hiphen, like -FIHqoTcZog does not work.
I was wondering is there a way to escape every single character of that ID from shell interpretation, for instance using as an ID: -FIHqoTcZog, but this did not work in my case.



The scripts i used was : youtube-comment-downloader and
youtube-comment-scraper. Both require video ID. Even if that is surrounded by single or double quotes the ID works, but neither works if the video ID starts with a hyphen.



Youtube-dl had similar issue before, but now it accepts ID starting with hyphen: this is done by using the option --id , still it does not work in our case unless the hyphen is preceded by --, making the video name into --id -- -FIHqoTcZog when it is ok to be --id xxxxxxxxxxx in another case where the ID does not start with a hyphen.



Is there any way arround for my scripts to work with ID starting with a hyphen, like the way how it did in the Youtube-dl's case, or using another work arround?







share|improve this question




















  • Does --id=-SoMeID work?
    – Kusalananda
    Mar 5 at 14:34










  • @Kusalananda, that one is only a work around for Youtube-dl , and it is then for a hyphen starting ID: --id -- -xxxxxxxx, the two other scripts do not accept that form at all.
    – pigeon
    Mar 5 at 14:44










  • Since this is getting sent to an HTTP server, what about replacing the hyphen with "%2D"?
    – ErikF
    Mar 5 at 16:11










  • The --id option of youtube-dl doesn't do what you think: "Use only video ID in file name". That's why you still need to use --.
    – nxnev
    Mar 5 at 20:21














up vote
0
down vote

favorite












I have tried two separate scripts for scrapping all comments of a Youtube video.
Everything works fine, but there was one problem:Youtube video ID's starting with a hiphen, like -FIHqoTcZog does not work.
I was wondering is there a way to escape every single character of that ID from shell interpretation, for instance using as an ID: -FIHqoTcZog, but this did not work in my case.



The scripts i used was : youtube-comment-downloader and
youtube-comment-scraper. Both require video ID. Even if that is surrounded by single or double quotes the ID works, but neither works if the video ID starts with a hyphen.



Youtube-dl had similar issue before, but now it accepts ID starting with hyphen: this is done by using the option --id , still it does not work in our case unless the hyphen is preceded by --, making the video name into --id -- -FIHqoTcZog when it is ok to be --id xxxxxxxxxxx in another case where the ID does not start with a hyphen.



Is there any way arround for my scripts to work with ID starting with a hyphen, like the way how it did in the Youtube-dl's case, or using another work arround?







share|improve this question




















  • Does --id=-SoMeID work?
    – Kusalananda
    Mar 5 at 14:34










  • @Kusalananda, that one is only a work around for Youtube-dl , and it is then for a hyphen starting ID: --id -- -xxxxxxxx, the two other scripts do not accept that form at all.
    – pigeon
    Mar 5 at 14:44










  • Since this is getting sent to an HTTP server, what about replacing the hyphen with "%2D"?
    – ErikF
    Mar 5 at 16:11










  • The --id option of youtube-dl doesn't do what you think: "Use only video ID in file name". That's why you still need to use --.
    – nxnev
    Mar 5 at 20:21












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have tried two separate scripts for scrapping all comments of a Youtube video.
Everything works fine, but there was one problem:Youtube video ID's starting with a hiphen, like -FIHqoTcZog does not work.
I was wondering is there a way to escape every single character of that ID from shell interpretation, for instance using as an ID: -FIHqoTcZog, but this did not work in my case.



The scripts i used was : youtube-comment-downloader and
youtube-comment-scraper. Both require video ID. Even if that is surrounded by single or double quotes the ID works, but neither works if the video ID starts with a hyphen.



Youtube-dl had similar issue before, but now it accepts ID starting with hyphen: this is done by using the option --id , still it does not work in our case unless the hyphen is preceded by --, making the video name into --id -- -FIHqoTcZog when it is ok to be --id xxxxxxxxxxx in another case where the ID does not start with a hyphen.



Is there any way arround for my scripts to work with ID starting with a hyphen, like the way how it did in the Youtube-dl's case, or using another work arround?







share|improve this question












I have tried two separate scripts for scrapping all comments of a Youtube video.
Everything works fine, but there was one problem:Youtube video ID's starting with a hiphen, like -FIHqoTcZog does not work.
I was wondering is there a way to escape every single character of that ID from shell interpretation, for instance using as an ID: -FIHqoTcZog, but this did not work in my case.



The scripts i used was : youtube-comment-downloader and
youtube-comment-scraper. Both require video ID. Even if that is surrounded by single or double quotes the ID works, but neither works if the video ID starts with a hyphen.



Youtube-dl had similar issue before, but now it accepts ID starting with hyphen: this is done by using the option --id , still it does not work in our case unless the hyphen is preceded by --, making the video name into --id -- -FIHqoTcZog when it is ok to be --id xxxxxxxxxxx in another case where the ID does not start with a hyphen.



Is there any way arround for my scripts to work with ID starting with a hyphen, like the way how it did in the Youtube-dl's case, or using another work arround?









share|improve this question











share|improve this question




share|improve this question










asked Mar 5 at 14:29









pigeon

5217




5217











  • Does --id=-SoMeID work?
    – Kusalananda
    Mar 5 at 14:34










  • @Kusalananda, that one is only a work around for Youtube-dl , and it is then for a hyphen starting ID: --id -- -xxxxxxxx, the two other scripts do not accept that form at all.
    – pigeon
    Mar 5 at 14:44










  • Since this is getting sent to an HTTP server, what about replacing the hyphen with "%2D"?
    – ErikF
    Mar 5 at 16:11










  • The --id option of youtube-dl doesn't do what you think: "Use only video ID in file name". That's why you still need to use --.
    – nxnev
    Mar 5 at 20:21
















  • Does --id=-SoMeID work?
    – Kusalananda
    Mar 5 at 14:34










  • @Kusalananda, that one is only a work around for Youtube-dl , and it is then for a hyphen starting ID: --id -- -xxxxxxxx, the two other scripts do not accept that form at all.
    – pigeon
    Mar 5 at 14:44










  • Since this is getting sent to an HTTP server, what about replacing the hyphen with "%2D"?
    – ErikF
    Mar 5 at 16:11










  • The --id option of youtube-dl doesn't do what you think: "Use only video ID in file name". That's why you still need to use --.
    – nxnev
    Mar 5 at 20:21















Does --id=-SoMeID work?
– Kusalananda
Mar 5 at 14:34




Does --id=-SoMeID work?
– Kusalananda
Mar 5 at 14:34












@Kusalananda, that one is only a work around for Youtube-dl , and it is then for a hyphen starting ID: --id -- -xxxxxxxx, the two other scripts do not accept that form at all.
– pigeon
Mar 5 at 14:44




@Kusalananda, that one is only a work around for Youtube-dl , and it is then for a hyphen starting ID: --id -- -xxxxxxxx, the two other scripts do not accept that form at all.
– pigeon
Mar 5 at 14:44












Since this is getting sent to an HTTP server, what about replacing the hyphen with "%2D"?
– ErikF
Mar 5 at 16:11




Since this is getting sent to an HTTP server, what about replacing the hyphen with "%2D"?
– ErikF
Mar 5 at 16:11












The --id option of youtube-dl doesn't do what you think: "Use only video ID in file name". That's why you still need to use --.
– nxnev
Mar 5 at 20:21




The --id option of youtube-dl doesn't do what you think: "Use only video ID in file name". That's why you still need to use --.
– nxnev
Mar 5 at 20:21










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










Related question: What does “--” (double-dash) mean? (also known as “bare double dash”)




The hyphen character is not interpreted by your shell but by the program/script (its parser, more precisely) you are using. That's why escaping it (at the shell level) doesn't work.



Programs often recognize arguments with leading hyphen(s) as options, not as operands. To interpret arguments like -foo as operands, programs usually follow one or more of these ways:



  • Recognize the first -- argument as the end of options marker: program -- -foo

  • Let you pass operands as option-arguments: program --option -foo

  • Recognize operands in alternative ways: program prefix-foo

In your specific scenario:




  • youtube-dl accepts:

    • -- -FIHqoTcZog

    • https://www.youtube.com/watch?v=-FIHqoTcZog



  • youtube-comment-downloader seems to accept:

    • --youtubeid -FIHqoTcZog



  • youtube-comment-scraper seems to accept:

    • -- -FIHqoTcZog

    • https://www.youtube.com/watch?v=-FIHqoTcZog






share|improve this answer



























    up vote
    0
    down vote













    Finally, i found one solution to the script youtube-comment-scraper after installing it again, suddenly , adding -- in front of a video ID starting with - worked.
    This hint is still not available in any of their documentation.
    Now this works:
    youtube-comment-scraper --output OtherFile -f csv -- -FIHqoTcZog



    In the other script it still does not work yet.






    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );








       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428279%2fscrips-does-not-accept-video-id-starting-with-a-hyphen%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote



      accepted










      Related question: What does “--” (double-dash) mean? (also known as “bare double dash”)




      The hyphen character is not interpreted by your shell but by the program/script (its parser, more precisely) you are using. That's why escaping it (at the shell level) doesn't work.



      Programs often recognize arguments with leading hyphen(s) as options, not as operands. To interpret arguments like -foo as operands, programs usually follow one or more of these ways:



      • Recognize the first -- argument as the end of options marker: program -- -foo

      • Let you pass operands as option-arguments: program --option -foo

      • Recognize operands in alternative ways: program prefix-foo

      In your specific scenario:




      • youtube-dl accepts:

        • -- -FIHqoTcZog

        • https://www.youtube.com/watch?v=-FIHqoTcZog



      • youtube-comment-downloader seems to accept:

        • --youtubeid -FIHqoTcZog



      • youtube-comment-scraper seems to accept:

        • -- -FIHqoTcZog

        • https://www.youtube.com/watch?v=-FIHqoTcZog






      share|improve this answer
























        up vote
        2
        down vote



        accepted










        Related question: What does “--” (double-dash) mean? (also known as “bare double dash”)




        The hyphen character is not interpreted by your shell but by the program/script (its parser, more precisely) you are using. That's why escaping it (at the shell level) doesn't work.



        Programs often recognize arguments with leading hyphen(s) as options, not as operands. To interpret arguments like -foo as operands, programs usually follow one or more of these ways:



        • Recognize the first -- argument as the end of options marker: program -- -foo

        • Let you pass operands as option-arguments: program --option -foo

        • Recognize operands in alternative ways: program prefix-foo

        In your specific scenario:




        • youtube-dl accepts:

          • -- -FIHqoTcZog

          • https://www.youtube.com/watch?v=-FIHqoTcZog



        • youtube-comment-downloader seems to accept:

          • --youtubeid -FIHqoTcZog



        • youtube-comment-scraper seems to accept:

          • -- -FIHqoTcZog

          • https://www.youtube.com/watch?v=-FIHqoTcZog






        share|improve this answer






















          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          Related question: What does “--” (double-dash) mean? (also known as “bare double dash”)




          The hyphen character is not interpreted by your shell but by the program/script (its parser, more precisely) you are using. That's why escaping it (at the shell level) doesn't work.



          Programs often recognize arguments with leading hyphen(s) as options, not as operands. To interpret arguments like -foo as operands, programs usually follow one or more of these ways:



          • Recognize the first -- argument as the end of options marker: program -- -foo

          • Let you pass operands as option-arguments: program --option -foo

          • Recognize operands in alternative ways: program prefix-foo

          In your specific scenario:




          • youtube-dl accepts:

            • -- -FIHqoTcZog

            • https://www.youtube.com/watch?v=-FIHqoTcZog



          • youtube-comment-downloader seems to accept:

            • --youtubeid -FIHqoTcZog



          • youtube-comment-scraper seems to accept:

            • -- -FIHqoTcZog

            • https://www.youtube.com/watch?v=-FIHqoTcZog






          share|improve this answer












          Related question: What does “--” (double-dash) mean? (also known as “bare double dash”)




          The hyphen character is not interpreted by your shell but by the program/script (its parser, more precisely) you are using. That's why escaping it (at the shell level) doesn't work.



          Programs often recognize arguments with leading hyphen(s) as options, not as operands. To interpret arguments like -foo as operands, programs usually follow one or more of these ways:



          • Recognize the first -- argument as the end of options marker: program -- -foo

          • Let you pass operands as option-arguments: program --option -foo

          • Recognize operands in alternative ways: program prefix-foo

          In your specific scenario:




          • youtube-dl accepts:

            • -- -FIHqoTcZog

            • https://www.youtube.com/watch?v=-FIHqoTcZog



          • youtube-comment-downloader seems to accept:

            • --youtubeid -FIHqoTcZog



          • youtube-comment-scraper seems to accept:

            • -- -FIHqoTcZog

            • https://www.youtube.com/watch?v=-FIHqoTcZog







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 5 at 20:17









          nxnev

          2,4522423




          2,4522423






















              up vote
              0
              down vote













              Finally, i found one solution to the script youtube-comment-scraper after installing it again, suddenly , adding -- in front of a video ID starting with - worked.
              This hint is still not available in any of their documentation.
              Now this works:
              youtube-comment-scraper --output OtherFile -f csv -- -FIHqoTcZog



              In the other script it still does not work yet.






              share|improve this answer
























                up vote
                0
                down vote













                Finally, i found one solution to the script youtube-comment-scraper after installing it again, suddenly , adding -- in front of a video ID starting with - worked.
                This hint is still not available in any of their documentation.
                Now this works:
                youtube-comment-scraper --output OtherFile -f csv -- -FIHqoTcZog



                In the other script it still does not work yet.






                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Finally, i found one solution to the script youtube-comment-scraper after installing it again, suddenly , adding -- in front of a video ID starting with - worked.
                  This hint is still not available in any of their documentation.
                  Now this works:
                  youtube-comment-scraper --output OtherFile -f csv -- -FIHqoTcZog



                  In the other script it still does not work yet.






                  share|improve this answer












                  Finally, i found one solution to the script youtube-comment-scraper after installing it again, suddenly , adding -- in front of a video ID starting with - worked.
                  This hint is still not available in any of their documentation.
                  Now this works:
                  youtube-comment-scraper --output OtherFile -f csv -- -FIHqoTcZog



                  In the other script it still does not work yet.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 5 at 15:40









                  pigeon

                  5217




                  5217






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428279%2fscrips-does-not-accept-video-id-starting-with-a-hyphen%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay