Format of cookies when using wget?

Multi tool use
Multi tool use

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











up vote
24
down vote

favorite
9












What's the Netscape format of wget's cookies.txt? I need to mirror a website that requires login.
I use a Chrome extension that returns cookies in that format, I save them in cookies.txt, import with wget command but to no use, it just downloads the content like I'm not logged in at all.



I appreciate any help.










share|improve this question



























    up vote
    24
    down vote

    favorite
    9












    What's the Netscape format of wget's cookies.txt? I need to mirror a website that requires login.
    I use a Chrome extension that returns cookies in that format, I save them in cookies.txt, import with wget command but to no use, it just downloads the content like I'm not logged in at all.



    I appreciate any help.










    share|improve this question

























      up vote
      24
      down vote

      favorite
      9









      up vote
      24
      down vote

      favorite
      9






      9





      What's the Netscape format of wget's cookies.txt? I need to mirror a website that requires login.
      I use a Chrome extension that returns cookies in that format, I save them in cookies.txt, import with wget command but to no use, it just downloads the content like I'm not logged in at all.



      I appreciate any help.










      share|improve this question















      What's the Netscape format of wget's cookies.txt? I need to mirror a website that requires login.
      I use a Chrome extension that returns cookies in that format, I save them in cookies.txt, import with wget command but to no use, it just downloads the content like I'm not logged in at all.



      I appreciate any help.







      wget






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 6 '16 at 15:41









      geckon

      1034




      1034










      asked Apr 16 '12 at 12:19









      Zarko Djuric

      143116




      143116




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          31
          down vote



          accepted










          The format is Netscape format as stated in the man page and this format is:




          The layout of Netscape's cookies.txt file is such that each line
          contains one name-value pair. An example cookies.txt file may have an
          entry that looks like this:



          .netscape.com TRUE / FALSE 946684799 NETSCAPE_ID 100103



          Each line represents a single piece of stored information. A tab is
          inserted between each of the fields.



          From left-to-right, here is what each field represents:



          domain - The domain that created AND that can read the variable.



          flag - A TRUE/FALSE value indicating if all machines within a given domain can access the variable. This value is set automatically by the
          browser, depending on the value you set for domain.



          path - The path
          within the domain that the variable is valid for.



          secure - A
          TRUE/FALSE value indicating if a secure connection with the domain is
          needed to access the variable.



          expiration - The UNIX time that the
          variable will expire on. UNIX time is defined as the number of seconds
          since Jan 1, 1970 00:00:00 GMT.



          name - The name of the variable.



          value
          - The value of the variable.




          (From "The Unofficial Cookie FAQ", edited for clarity)






          share|improve this answer


















          • 2




            Is the file Tab or Space seperated?
            – Ferrybig
            Nov 1 '15 at 22:14






          • 3




            @ferrybig Tabs are used.
            – geckon
            Jan 6 '16 at 15:15










          • anything special is the cookie comes from e.g. 127.0.0.1 instead of something with a domain name ?
            – PypeBros
            May 9 at 10:08

















          up vote
          3
          down vote













          One way of getting cookies for wget is to use the --keep-session-cookies options of wget.



          For example :



          wget --keep-session-cookies --save-cookies cookies.txt "http://MYSITE/?__login=USER&__password=PASS"


          The ?__login etc depends on the web site you're trying to mirror, you might have to look at how the authentication form works.



          Then you can use :



          wget --mirror --load-cookies cookies.txt http://MYSITE/





          share|improve this answer
















          • 3




            this doesn't answer the question of what the file format is
            – Michael
            Jan 9 '15 at 20:37

















          up vote
          1
          down vote













          The Netscape cookies file format for each data line is as above, but you won't be able to read it in with HTTP::Cookies::Netscape unless it has a header line like this, which the complete file format requires:



          # Netscape HTTP Cookie File


          or this:



          # HTTP Cookie File





          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: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            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%2f36531%2fformat-of-cookies-when-using-wget%23new-answer', 'question_page');

            );

            Post as a guest






























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            31
            down vote



            accepted










            The format is Netscape format as stated in the man page and this format is:




            The layout of Netscape's cookies.txt file is such that each line
            contains one name-value pair. An example cookies.txt file may have an
            entry that looks like this:



            .netscape.com TRUE / FALSE 946684799 NETSCAPE_ID 100103



            Each line represents a single piece of stored information. A tab is
            inserted between each of the fields.



            From left-to-right, here is what each field represents:



            domain - The domain that created AND that can read the variable.



            flag - A TRUE/FALSE value indicating if all machines within a given domain can access the variable. This value is set automatically by the
            browser, depending on the value you set for domain.



            path - The path
            within the domain that the variable is valid for.



            secure - A
            TRUE/FALSE value indicating if a secure connection with the domain is
            needed to access the variable.



            expiration - The UNIX time that the
            variable will expire on. UNIX time is defined as the number of seconds
            since Jan 1, 1970 00:00:00 GMT.



            name - The name of the variable.



            value
            - The value of the variable.




            (From "The Unofficial Cookie FAQ", edited for clarity)






            share|improve this answer


















            • 2




              Is the file Tab or Space seperated?
              – Ferrybig
              Nov 1 '15 at 22:14






            • 3




              @ferrybig Tabs are used.
              – geckon
              Jan 6 '16 at 15:15










            • anything special is the cookie comes from e.g. 127.0.0.1 instead of something with a domain name ?
              – PypeBros
              May 9 at 10:08














            up vote
            31
            down vote



            accepted










            The format is Netscape format as stated in the man page and this format is:




            The layout of Netscape's cookies.txt file is such that each line
            contains one name-value pair. An example cookies.txt file may have an
            entry that looks like this:



            .netscape.com TRUE / FALSE 946684799 NETSCAPE_ID 100103



            Each line represents a single piece of stored information. A tab is
            inserted between each of the fields.



            From left-to-right, here is what each field represents:



            domain - The domain that created AND that can read the variable.



            flag - A TRUE/FALSE value indicating if all machines within a given domain can access the variable. This value is set automatically by the
            browser, depending on the value you set for domain.



            path - The path
            within the domain that the variable is valid for.



            secure - A
            TRUE/FALSE value indicating if a secure connection with the domain is
            needed to access the variable.



            expiration - The UNIX time that the
            variable will expire on. UNIX time is defined as the number of seconds
            since Jan 1, 1970 00:00:00 GMT.



            name - The name of the variable.



            value
            - The value of the variable.




            (From "The Unofficial Cookie FAQ", edited for clarity)






            share|improve this answer


















            • 2




              Is the file Tab or Space seperated?
              – Ferrybig
              Nov 1 '15 at 22:14






            • 3




              @ferrybig Tabs are used.
              – geckon
              Jan 6 '16 at 15:15










            • anything special is the cookie comes from e.g. 127.0.0.1 instead of something with a domain name ?
              – PypeBros
              May 9 at 10:08












            up vote
            31
            down vote



            accepted







            up vote
            31
            down vote



            accepted






            The format is Netscape format as stated in the man page and this format is:




            The layout of Netscape's cookies.txt file is such that each line
            contains one name-value pair. An example cookies.txt file may have an
            entry that looks like this:



            .netscape.com TRUE / FALSE 946684799 NETSCAPE_ID 100103



            Each line represents a single piece of stored information. A tab is
            inserted between each of the fields.



            From left-to-right, here is what each field represents:



            domain - The domain that created AND that can read the variable.



            flag - A TRUE/FALSE value indicating if all machines within a given domain can access the variable. This value is set automatically by the
            browser, depending on the value you set for domain.



            path - The path
            within the domain that the variable is valid for.



            secure - A
            TRUE/FALSE value indicating if a secure connection with the domain is
            needed to access the variable.



            expiration - The UNIX time that the
            variable will expire on. UNIX time is defined as the number of seconds
            since Jan 1, 1970 00:00:00 GMT.



            name - The name of the variable.



            value
            - The value of the variable.




            (From "The Unofficial Cookie FAQ", edited for clarity)






            share|improve this answer














            The format is Netscape format as stated in the man page and this format is:




            The layout of Netscape's cookies.txt file is such that each line
            contains one name-value pair. An example cookies.txt file may have an
            entry that looks like this:



            .netscape.com TRUE / FALSE 946684799 NETSCAPE_ID 100103



            Each line represents a single piece of stored information. A tab is
            inserted between each of the fields.



            From left-to-right, here is what each field represents:



            domain - The domain that created AND that can read the variable.



            flag - A TRUE/FALSE value indicating if all machines within a given domain can access the variable. This value is set automatically by the
            browser, depending on the value you set for domain.



            path - The path
            within the domain that the variable is valid for.



            secure - A
            TRUE/FALSE value indicating if a secure connection with the domain is
            needed to access the variable.



            expiration - The UNIX time that the
            variable will expire on. UNIX time is defined as the number of seconds
            since Jan 1, 1970 00:00:00 GMT.



            name - The name of the variable.



            value
            - The value of the variable.




            (From "The Unofficial Cookie FAQ", edited for clarity)







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 1 '15 at 21:45









            Venning

            305




            305










            answered Jun 17 '15 at 14:03









            ETL

            47143




            47143







            • 2




              Is the file Tab or Space seperated?
              – Ferrybig
              Nov 1 '15 at 22:14






            • 3




              @ferrybig Tabs are used.
              – geckon
              Jan 6 '16 at 15:15










            • anything special is the cookie comes from e.g. 127.0.0.1 instead of something with a domain name ?
              – PypeBros
              May 9 at 10:08












            • 2




              Is the file Tab or Space seperated?
              – Ferrybig
              Nov 1 '15 at 22:14






            • 3




              @ferrybig Tabs are used.
              – geckon
              Jan 6 '16 at 15:15










            • anything special is the cookie comes from e.g. 127.0.0.1 instead of something with a domain name ?
              – PypeBros
              May 9 at 10:08







            2




            2




            Is the file Tab or Space seperated?
            – Ferrybig
            Nov 1 '15 at 22:14




            Is the file Tab or Space seperated?
            – Ferrybig
            Nov 1 '15 at 22:14




            3




            3




            @ferrybig Tabs are used.
            – geckon
            Jan 6 '16 at 15:15




            @ferrybig Tabs are used.
            – geckon
            Jan 6 '16 at 15:15












            anything special is the cookie comes from e.g. 127.0.0.1 instead of something with a domain name ?
            – PypeBros
            May 9 at 10:08




            anything special is the cookie comes from e.g. 127.0.0.1 instead of something with a domain name ?
            – PypeBros
            May 9 at 10:08












            up vote
            3
            down vote













            One way of getting cookies for wget is to use the --keep-session-cookies options of wget.



            For example :



            wget --keep-session-cookies --save-cookies cookies.txt "http://MYSITE/?__login=USER&__password=PASS"


            The ?__login etc depends on the web site you're trying to mirror, you might have to look at how the authentication form works.



            Then you can use :



            wget --mirror --load-cookies cookies.txt http://MYSITE/





            share|improve this answer
















            • 3




              this doesn't answer the question of what the file format is
              – Michael
              Jan 9 '15 at 20:37














            up vote
            3
            down vote













            One way of getting cookies for wget is to use the --keep-session-cookies options of wget.



            For example :



            wget --keep-session-cookies --save-cookies cookies.txt "http://MYSITE/?__login=USER&__password=PASS"


            The ?__login etc depends on the web site you're trying to mirror, you might have to look at how the authentication form works.



            Then you can use :



            wget --mirror --load-cookies cookies.txt http://MYSITE/





            share|improve this answer
















            • 3




              this doesn't answer the question of what the file format is
              – Michael
              Jan 9 '15 at 20:37












            up vote
            3
            down vote










            up vote
            3
            down vote









            One way of getting cookies for wget is to use the --keep-session-cookies options of wget.



            For example :



            wget --keep-session-cookies --save-cookies cookies.txt "http://MYSITE/?__login=USER&__password=PASS"


            The ?__login etc depends on the web site you're trying to mirror, you might have to look at how the authentication form works.



            Then you can use :



            wget --mirror --load-cookies cookies.txt http://MYSITE/





            share|improve this answer












            One way of getting cookies for wget is to use the --keep-session-cookies options of wget.



            For example :



            wget --keep-session-cookies --save-cookies cookies.txt "http://MYSITE/?__login=USER&__password=PASS"


            The ?__login etc depends on the web site you're trying to mirror, you might have to look at how the authentication form works.



            Then you can use :



            wget --mirror --load-cookies cookies.txt http://MYSITE/






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Apr 16 '12 at 14:12









            Arthur Lutz

            1864




            1864







            • 3




              this doesn't answer the question of what the file format is
              – Michael
              Jan 9 '15 at 20:37












            • 3




              this doesn't answer the question of what the file format is
              – Michael
              Jan 9 '15 at 20:37







            3




            3




            this doesn't answer the question of what the file format is
            – Michael
            Jan 9 '15 at 20:37




            this doesn't answer the question of what the file format is
            – Michael
            Jan 9 '15 at 20:37










            up vote
            1
            down vote













            The Netscape cookies file format for each data line is as above, but you won't be able to read it in with HTTP::Cookies::Netscape unless it has a header line like this, which the complete file format requires:



            # Netscape HTTP Cookie File


            or this:



            # HTTP Cookie File





            share|improve this answer


























              up vote
              1
              down vote













              The Netscape cookies file format for each data line is as above, but you won't be able to read it in with HTTP::Cookies::Netscape unless it has a header line like this, which the complete file format requires:



              # Netscape HTTP Cookie File


              or this:



              # HTTP Cookie File





              share|improve this answer
























                up vote
                1
                down vote










                up vote
                1
                down vote









                The Netscape cookies file format for each data line is as above, but you won't be able to read it in with HTTP::Cookies::Netscape unless it has a header line like this, which the complete file format requires:



                # Netscape HTTP Cookie File


                or this:



                # HTTP Cookie File





                share|improve this answer














                The Netscape cookies file format for each data line is as above, but you won't be able to read it in with HTTP::Cookies::Netscape unless it has a header line like this, which the complete file format requires:



                # Netscape HTTP Cookie File


                or this:



                # HTTP Cookie File






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 4 mins ago









                kenorb

                7,996365105




                7,996365105










                answered Apr 2 '16 at 14:10









                Phil Goetz

                1112




                1112



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f36531%2fformat-of-cookies-when-using-wget%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    zGL sQI5jNAVMeDX9UOHXP3cx69jlSAgXIys YjdnFZ 1wrygu6a3MK kwgzB4J,582zWkRcnIXAS
                    Okb,T4YgQgO4RgOn

                    Popular posts from this blog

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

                    How many registers does an x86_64 CPU actually have?

                    Displaying single band from multi-band raster using QGIS