Skip to content

Instantly share code, notes, and snippets.

@gaomd
Last active October 28, 2023 09:13
Show Gist options
  • Select an option

  • Save gaomd/7da5de92561dbd0c6b44 to your computer and use it in GitHub Desktop.

Select an option

Save gaomd/7da5de92561dbd0c6b44 to your computer and use it in GitHub Desktop.

Revisions

  1. gaomd revised this gist Oct 5, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    //
    // This scripts helps you migrating V2EX's starred topics to Pinboard
    // https://www.v2ex.com/t/137169
    //
    // 0. Edit authToken variable below.
    // 1. Navigate to https://www.v2ex.com/my/topics
  2. gaomd revised this gist Oct 5, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -3,14 +3,14 @@
    //
    // 0. Edit authToken variable below.
    // 1. Navigate to https://www.v2ex.com/my/topics
    // 2. Paste code into browser console, and enter to exctute
    // 3. You should see the console scroll over some some outputs
    // 2. Paste code into browser console, and enter to execute
    // 3. You should see the console scroll over some outputs
    // 4. Wait for the "DONE :)" message
    // 5. Move to the next page, and continue step 1
    //
    // Head over to https://pinboard.in/api for more parameters.
    //
    // Get Auth Token from: https://pinboard.in/settings/password
    // Get your Auth Token from: https://pinboard.in/settings/password
    var authToken = "username:random-token";
    // Tags may be separated by comma? (untested)
    var tags = "v2ex";
  3. gaomd created this gist Oct 5, 2014.
    27 changes: 27 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    //
    // This scripts helps you migrating V2EX's starred topics to Pinboard
    //
    // 0. Edit authToken variable below.
    // 1. Navigate to https://www.v2ex.com/my/topics
    // 2. Paste code into browser console, and enter to exctute
    // 3. You should see the console scroll over some some outputs
    // 4. Wait for the "DONE :)" message
    // 5. Move to the next page, and continue step 1
    //
    // Head over to https://pinboard.in/api for more parameters.
    //
    // Get Auth Token from: https://pinboard.in/settings/password
    var authToken = "username:random-token";
    // Tags may be separated by comma? (untested)
    var tags = "v2ex";
    var index = 0;
    function add(url) {
    var img = new Image();
    img.src = url;
    }
    $(".item_title a").each(function() {
    var url = "https://api.pinboard.in/v1/posts/add?auth_token=" + authToken + "&tags=" + tags + "&url=https://www.v2ex.com" + $(this).attr("href").split("#")[0] + "&description=" + $(this).text();
    // Timeout 4000 cuz Pinboard have rate limit of 3s per request
    setTimeout(function() { add(url) }, index++ * 4000);
    })
    setTimeout(function() { alert("DONE :)"); }, index * 4000);