GithubHelp home page GithubHelp logo

Add Support for Megalodon.jp about archivenow HOT 4 CLOSED

oduwsdl avatar oduwsdl commented on September 22, 2024 1
Add Support for Megalodon.jp

from archivenow.

Comments (4)

myano avatar myano commented on September 22, 2024 2

Makes sense.

I figured it had something to do with the token but I was trying to use their http://gyo.tc/ to submit URLs and I didn't realize the importance of the cookies.

Thank you for the code. I was able to fairly easily add it as a custom handler in archivenow.

:-)

image

from archivenow.

maturban avatar maturban commented on September 22, 2024 1

I have tried to push several different pages to Megalodon.jp and found that the archive does not accept most of non-Japanese pages, so I am not sure if I am going to add it to ArchiveNow.

But if you want to add Megalodon.jp to your own copy of ArchiveNow or use a separate Python script, here is the Python code that can push pages to Megalodon.jp:


import requests 

# an example page to be pushed into the archive 
uri = 'http://jp-australia.com/2019/intro/' 

r = requests.get('http://megalodon.jp/?url='+uri) 
token = str(r.content).split('"token" value="',1)[1].split('"',1)[0]
cookies = dict(PHPSESSID=r.headers['Set-Cookie'].split('PHPSESSID=',1)[1].split(';',1)[0])

r2 = requests.post('http://megalodon.jp/pc/get_simple/decide',
                    data={"url":uri, "token":token},
                    cookies=cookies)
print 'The URI to the archived page :', str(r2.content).split('location.href = "',1)[1].split('"',1)[0]


from archivenow.

myano avatar myano commented on September 22, 2024 1

@maturban I didn't put the whole fork up here, but here is a Gist of the two files I modified.

The first file is a patch file of the differences I made to index.html and the second file is the handler I wrote.

https://gist.github.com/myano/88dfdb4fea27bb632293e107a663998a

from archivenow.

maturban avatar maturban commented on September 22, 2024

Perfect. Is your code available on Github?

from archivenow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.