Author

Topic: Self hosted API's for regular signature editing? (Read 250 times)

legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
December 28, 2023, 01:51:33 AM
#19
I think it would be fine, as long as it is not making too many requests per second, but since you're essentially running this once every 30 minutes, there's nothing to worry about.

The bigger problem is how are you going to do this properly when there is no forum API, and you need to rely on cookies and browser sessions and generally just getting it to work in the first place.

how you ever seen mturk? This give me more ideas like the feedback system they had via scripts.
I have no idea what that is, to be honest. Cheesy

Mturk is basically like paying sweatshop workers to make an iPhone or a pair of Nike sneakers except with online work.
hero member
Activity: 1438
Merit: 513
Mturk was a platform for micro earnings offered by Amazon, it was kinda like microlancer , but you would do stuff like validate receipts , test/enter captcha, Identify pictures, train bots ,surveys all kinds of stuff  you had tm/greasyfork scripts  with lots of downloads that basically acted as a 3rd party vetting system about the vendors offering the jobs once enough people used it. It also had convince scripts built in.
I can't believe nothing like this has been made for Bitcointalk tbh (to be fair I couldn't belive a scripted secondary platform like this existed for a site that generally paid pocket change for task, it was Amazon though.), we could do something like it right ? have wallets used under profile , signatures posted
Script blocking. Payment request,hot key post inserts like payment request. Merit to post ratio. Lots of useless uses but cool! The mturk script had features like a good rated vendor posting a high paying job would initiate a chime/notification, maybe something could be made on bct without login data needed.

I went down a new rabbit hole playing with CF pages/workers.
I'm impressed and can't believe I missed this. Based on what I see these can host simple website and apps free,possibly forever?
Worker routing has my interest in particular. Idk I'm still messing with this stuff scoping it out. Maybe a system could be built on it and really be set and forget.
https://developers.cloudflare.com/workers/
https://developers.cloudflare.com/pages/

Potential for a whole layer 2 of Bitcointalk.org user experience. not just signatures. Just thinking out loud.




legendary
Activity: 2758
Merit: 6830
how you ever seen mturk? This give me more ideas like the feedback system they had via scripts.
I have no idea what that is, to be honest. Cheesy
hero member
Activity: 1438
Merit: 513
legendary
Activity: 2758
Merit: 6830
I'm making an unnoficial API in Typescript that I'll start using on some of my projects. Here is the snippet for the profile editing I coded today (in case it helps you somehow):

Code:
public async sesc(): Promise {
  this.requireAuthenticated();
  const response = await this.api.get(
    "https://bitcointalk.org/index.php?action=profile",
  );
  const $ = cheerio.load(await response.text());
  const logoutUrl = $(
    'td.maintab_back a[href*="index.php?action=logout;sesc="]',
  ).attr("href");
  const sesc = logoutUrl?.match(/sesc=(.*)/);
  if (sesc && sesc[1]) {
    return sesc[1];
  }
  throw new Error("Could not get sesc");
}

public async getProfile(userId?: ProfileUserId): Promise {
  if (!userId) {
    this.requireAuthenticated();
  }

  const url = userId
    ? `https://bitcointalk.org/index.php?action=profile;u=${userId}`
    : "https://bitcointalk.org/index.php?action=profile";

  const response = await this.api.get(url);
  const html = await response.text();
  const $ = cheerio.load(html);

  const name = getTableRowValue($, "Name:");
  const posts = getTableRowValue($, "Posts:");
  const activity = getTableRowValue($, "Activity:");
  const merit = getTableRowValue($, "Merit:");
  const position = getTableRowValue($, "Position:");

  const profileUserId = $("a[href*=/index.php?action=merit;u=]").attr("href")
    ?.match(
      /\/index\.php\?action=merit;u=(\d+)/,
    )?.at(1);

  return {
    name,
    userId: Number(profileUserId),
    posts: Number(posts),
    activity: Number(activity),
    merit: Number(merit),
    position,
  };
}
 
  public async getProfileSettings() {
    this.requireAuthenticated();

    const response = await this.api.get(
      `https://bitcointalk.org/index.php?action=profile;sa=forumProfile`,
    );

    const html = await response.text();
    const $ = cheerio.load(html);

    const personalText = $(
      "#creator > table input[name=personalText]",
    ).attr("value")!;

    const birthYear = $("#creator > table input[name=bday3]").attr("value")!;
    const birthMonth = $("#creator > table input[name=bday1]").attr("value")!;
    const birthDay = $("#creator > table input[name=bday2]").attr("value")!;
    const location = $("#creator > table input[name=location]").attr("value")!;

    const gender = $([
      ...$(
        "#creator > table select[name=gender] > option",
      ),
    ].find((option) => $(option).attr("selected"))).attr("value") ?? 0;

    const ICQ = $("#creator > table input[name=ICQ]").attr("value")!;
    const AIM = $("#creator > table input[name=AIM]").attr("value")!;
    const MSN = $("#creator > table input[name=MSN]").attr("value")!;
    const YIM = $("#creator > table input[name=YIM]").attr("value")!;
    const signature = $("#creator > table textarea[name=signature]").text();
    const websiteTitle = $("#creator > table input[name=websiteTitle]").attr(
      "value",
    )!;
    const websiteUrl = $("#creator > table input[name=websiteUrl]").attr(
      "value",
    )!;
    const skype = $("#creator > table input[name='default_options[CP1]']").attr(
      "value",
    )!;
    const bitcoinAddress = $(
      "#creator > table input[namr='default_options[addr]']",
    ).attr("value")!;
    const otherContactInfo = $(
      $("#creator > table input[name='default_options[CP11]']"),
    ).attr("value")!;

    const showUntrustedFeedbackByDefault =
      $("#creator > table input.check[name='default_options[show_untrusted]']")
        .attr("checked") === "checked";
    const showPatrolLink =
      $("#creator > table input.check[name='default_options[showpatrol]']")
        .attr("checked") === "checked";

    const showPostCountByPosts =
      $("#creator > table input.check[name='default_options[showpostcount]']")
        .attr("checked") === "checked";

    const disableAds =
      $("#creator > table input.check[name='default_options[noads]']").attr(
        "checked",
      ) === "checked";

    const result = {
      personalText,
      birthYear: String(birthYear),
      birthMonth: String(birthMonth),
      birthDay: String(birthDay),
      location,
      gender: Number(gender),
      ICQ,
      AIM,
      MSN,
      YIM,
      signature,
      websiteTitle,
      websiteUrl,
      skype,
      bitcoinAddress,
      otherContactInfo,
      showUntrustedFeedbackByDefault,
      showPatrolLink,
      showPostCountByPosts,
      disableAds,
    };

    return result;
  }

  public async editProfile(data?: EditProfileData): Promise {
    const currentSettings = await this.getProfileSettings();
    const profile = await this.getProfile();
    const sesc = await this.sesc();

    const body = new FormData();

    const fields: Record = {
      personalText: data?.personalText ?? currentSettings.personalText,
      bday3: String(currentSettings.birthYear),
      bday2: String(currentSettings.birthDay),
      bday1: String(currentSettings.birthMonth),
      location: data?.location ?? currentSettings.location,
      gender: currentSettings.gender,
      ICQ: currentSettings.ICQ,
      AIM: currentSettings.AIM,
      MSN: currentSettings.MSN,
      YIM: currentSettings.YIM,
      signature: data?.signature ?? currentSettings.signature,
      websiteTitle: data?.websiteTitle ?? currentSettings.websiteTitle,
      websiteUrl: data?.websiteTitle ?? currentSettings.websiteUrl,
      "default_options[CP1]": currentSettings.skype,
      "default_options[addr]": data?.bitcoinAddress ??
        currentSettings.bitcoinAddress,
      "default_options[show_untrusted]": Number(
        currentSettings.showUntrustedFeedbackByDefault,
      ),
      "default_options[showpatrol]": Number(currentSettings.showPatrolLink),
      "default_options[showpostcount]": Number(
        currentSettings.showPostCountByPosts,
      ),
      "default_options[CP11]": currentSettings.otherContactInfo,
      "default_options[noads]": Number(currentSettings.disableAds),
      sc: sesc,
      userID: profile.userId,
      sa: "forumProfile",
    };

    for (const field in fields) {
      body.set(field, String(fields[field]));
    }

    await this.api.post(
      "https://bitcointalk.org/index.php?action=profile2",
      {
        body,
      },
    );

    return true;
  }

Code:
const forum = new BitcoinTalkApi();
await forum.auth({
  username: "TryNinja_BOT2",
  password: "xxxxxxxxxx",
  captchaCode: "xxxxxxxxx",
});

await forum.editProfile({ signature: "my signature bbcode here!" });

Some stuff is missing because it's WIP, but you can still have an idea of how it works.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Would self-hosting an API (or something) that managed my signature be frowned upon?
I won't frown on this.

unless LoyceV would do their secondary mobile acc for ex.
Ain't gonna happen Smiley

ninjastic would see how many times that snippet was posted for that user and automatically detect if the signature was equipped on post and how many times a post made with that code attached to the sig.
But Ninjastic won't see how many times older posts with the same signature were loaded.
hero member
Activity: 1438
Merit: 513
i didnt think you could have a tracking pixel anywhere in the forum; wasnt that the whole point of the forum image proxy setup?
You can track page access, but not ip address.
I said a pixel style snippet. like a user code for that campaign. It would just be used for tracking the sig. not how google designed em.

Meaning a tracker.   for example a users sig would have that snippet in it , ninjastic would see how many times that snippet was posted for that user and automatically detect if the signature was equipped on post and how many times a post made with that code attached to the sig.

hero member
Activity: 1659
Merit: 687
LoyceV on the road. Or couch.
i didnt think you could have a tracking pixel anywhere in the forum; wasnt that the whole point of the forum image proxy setup?
You can track page access, but not ip address.
legendary
Activity: 4354
Merit: 3614
what is this "brake pedal" you speak of?
You can't have a tracking pixel in a signature.

i didnt think you could have a tracking pixel anywhere in the forum; wasnt that the whole point of the forum image proxy setup?
hero member
Activity: 1659
Merit: 687
LoyceV on the road. Or couch.
You can't have a tracking pixel in a signature.
hero member
Activity: 1438
Merit: 513
I have no doubt "You" could pull that off. (on your own profile)

But I dont know of anyone that would give a password for something like that unless LoyceV would do their secondary mobile acc for ex.
Of course, that's why I never released a built-in DM notification on the SuperNotifier bot.

[...] and the question was how to change the signature automatically [...]
That wouldn't be a problem.

Login, get cookies, then POST https://bitcointalk.org/index.php?action=profile2 with a FormData containing all parameters for the profile form, which include personalText and signature. You can get them by checking your browser's developer tools "Network" tab for the request after editing your profile.

If it's running on a userscript (i.e tampermonkey), all you need to do is create a loop that gets your block height data and then do the above with the right bbcode string.

Thanks!

I started liking your idea more though.

 What if you created a user network where everyone can wear the sigs you collect on your portal and they get 80% of what was paid for that ad (proportionally) track metric with a small pixel style snippet in the sig?

Might need a new sub set of signature rules to fit the extra tracker but I could see campaign managers eating something like this up.
legendary
Activity: 2758
Merit: 6830
I have no doubt "You" could pull that off. (on your own profile)

But I dont know of anyone that would give a password for something like that unless LoyceV would do their secondary mobile acc for ex.
Of course, that's why I never released a built-in DM notification on the SuperNotifier bot.

[...] and the question was how to change the signature automatically [...]
That wouldn't be a problem.

Login, get cookies, then POST https://bitcointalk.org/index.php?action=profile2 with a FormData containing all parameters for the profile form, which include personalText and signature. You can get them by checking your browser's developer tools "Network" tab for the request after editing your profile.

If it's running on a userscript (i.e tampermonkey), all you need to do is create a loop that fetches your block height data and then do the above with the right bbcode string.
hero member
Activity: 1438
Merit: 513
I was thinking of an automated pay-per-day signature4rent service.

Something like:

1. You go to rentsignature.ninjastic.space;
2. You paste the bbcode for your signature (and maybe even personal text or avatar);
3. You get a BTC address to pay to;
4. You send $150 in BTC for 1 week;
5. A bot keeps track of the time left and switches up my signature when it needs to.

Caution would be needed so a troll can't add ilegal stuff on your signature, maybe some quick moderation where your signature needs to be approved. Also, opening this to other users would require them to send their password over.

I might code this just for fun (very very very likely won't actually use it on my account, though).

Cheesy

I started on that idea, and the question was how to change the signature automatically, easily then I started complicating stuff with updateable metrics.

I have no doubt "You" could pull that off. (on your own profile)

But I dont know of anyone that would give a password for something like that unless LoyceV would do their secondary mobile acc for ex.

Making a signature editor seems like a necessity for any of these ideas regardless. You could eliminate the need for password with a GF/TM script though, right point and shoot (for your scenario)?





legendary
Activity: 2758
Merit: 6830
I was thinking of an automated pay-per-day signature4rent service.

Something like:

1. You go to rentsignature.ninjastic.space;
2. You paste the bbcode for your signature (and maybe even personal text or avatar);
3. You get a BTC address to pay to;
4. You send $150 in BTC for 1 week;
5. A bot keeps track of the time left and switches up my signature when it needs to.

Caution would be needed so a troll can't add ilegal stuff on your signature, maybe some quick moderation where your signature needs to be approved. Also, opening this to other users would require them to send their password over.

I might code this just for fun (very very very likely won't use it on my account).

Cheesy
hero member
Activity: 1438
Merit: 513
If I understood you correctly, you are talking about something like:



Code:
If I understood you correctly, you are talking about something like:
source ---> https://bitcointalksearch.org/topic/ann-bitcoindatascience-sponsored-by-bcgame-5445282

Signatures have many restrictions, such as inserting an image, so I think that any API code would be difficult, or at least difficult, to create a dynamic signature.
Something like this yes, but instead of an image it relays the data in human readable format but inserts it into signature for you via script if change is detected from orgin source or a callout for every hour or something.

think of an block tracker on your signature but since we cant do images we have to get console to automatically update your sig (after communicating with a url or api) every 30 mins with the current block.

Or a price ticker.    or a new article from a bitcoin newspaper that allows api's/scraping. or a combination of all the above.


An example of how the signature itself would look.

BTCitcoin Price 43,999
Halving countdown! 135 Days! 
Current Block No 820,459

italic fields could be targeted/changed via api/console.


 



legendary
Activity: 2688
Merit: 3983
If I understood you correctly, you are talking about something like:



Code:
If I understood you correctly, you are talking about something like:
source ---> https://bitcointalksearch.org/topic/ann-bitcoindatascience-sponsored-by-bcgame-5445282

Signatures have many restrictions, such as inserting an image, so I think that any API code would be difficult, or at least difficult, to create a dynamic signature.
hero member
Activity: 1438
Merit: 513
Would self-hosting an API (or something) that managed my signature be frowned upon?
I don't think so. The forum allows bots if they follow the 1 request per second rule.

My archive doesn't track signatures and (AFAIK) neither does BPIP. Loyce's only does that for managers that hire his services.

I've never thought of that, interesting idea.

Crazy...I'm on your GreasyFork page , came back and you chimed in!

I'm particularly interested in https://greasyfork.org/en/scripts/465886-bitcointalk-image-upload-button-talkimg

I'm thinking things like a halving countdown, only updates on a new block for example.

Or an easy price tracker, once every 30 mins. Nothing actually "Live".
legendary
Activity: 2758
Merit: 6830
Would self-hosting an API (or something) that managed my signature be frowned upon?
I don't think so. The forum allows bots if they follow the 1 request per second rule.

My archive doesn't track signatures and (AFAIK) neither does BPIP. Loyce's only does that for managers that hire his services.

I've never thought of that, interesting idea.
hero member
Activity: 1438
Merit: 513
Would self-hosting an API (or something) that managed my signature be frowned upon?

For example, having a price ticker scape BTC price and update it in text/BB format every 30 mins via tapermonkey or something like that to my signature destination.

http://html/body/div[2]/table/tbody/tr/td[2]/form/table/tbody/tr[3]/td/table/tbody/tr[13]/td[2]/textarea

this is just one way to go about it. I could explore unofficial Api's and see what could be conjured up.

I guess my main concern is even if this is fair game, would it be frowned upon it changing so much?

I could see it potentially causing confusion in archives and stuff,
 
or just being annoying if a color changed or something every 30 mins even if I'm not posting.

I'd like to tinker with the notion though!

I've been thinking for years of something different and neat to attempt involving signatures.

Jump to: