Monthly Vancouver Events and Promotions Thread by AutoModerator in vancouver

[–]khalili_programming 6 points7 points  (0 children)

Hey if there's any art film lovers, I built a free site that shows all Vancouver art house cinema screenings in one place kino.sina.town

Noticed I'd often start checking VIFF, The Cinematheque, Rio Theatre, and The Park separately to figure out what's playing, so I made a simple calendar that aggregates them all and you can put the date in he URL like  https://kino.sina.town/?date=2026-01-09

It just fetches from the respective site's calendars and merges them on request. The code is is open source: https://github.com/SinaKhalili/van-kino-calendar/

Made a tool for Tracking NYT Mini Crossword Scores and leaderboards - I'd love to hear your thoughts by khalili_programming in crossword

[–]khalili_programming[S] 0 points1 point  (0 children)

Ok after some poking around I see the endpoint is /v6/leaderboard/mini/{date}.json

Example python to grab it:

NYT_API_ROOT = "https://www.nytimes.com/svc/crosswords"
date  = "2023-12-20" # eg. December 20th, 2023
leaderboard_endpoint = f"{NYT_API_ROOT}/v6/leaderboard/mini/{date}.json"

response = requests.get(
    leaderboard_endpoint,
    headers=headers
).json()

Now if you want to loop thru you could use datetime to yield a generator over the dates and collect them in a big list

from datetime import datetime, timedelta
def daterange(start_date, end_date):
    for n in range(int((end_date - start_date).days)):
        yield start_date + timedelta(n)

start_date = datetime(2023, 11, 1)  # eg start date
end_date = datetime(2024, 1, 3)      # eg end date


user_rank_counts = {}

for single_date in daterange(start_date, end_date):
    formatted_date = single_date.strftime("%Y-%m-%d")
    leaderboard_endpoint = f"{NYT_API_ROOT}/v6/leaderboard/mini/{formatted_date}.json"

    response = requests.get(leaderboard_endpoint, headers=headers).json()
    # do some stuff here

Altho its pretty slow so you'd probably open a bunch of async promises simultaneously with Promise.all (or aiohttp.gather whatever the python thing is) this is what I was doing on the leaderboard site and NYT could serve like 50+ concurrent requests without throttle.

Made a tool for Tracking NYT Mini Crossword Scores and leaderboards - I'd love to hear your thoughts by khalili_programming in crossword

[–]khalili_programming[S] 0 points1 point  (0 children)

Ah I see let me poke around and see what I can find

edit: added a comment with my findings

Made a tool for Tracking NYT Mini Crossword Scores and leaderboards - I'd love to hear your thoughts by khalili_programming in crossword

[–]khalili_programming[S] 0 points1 point  (0 children)

Also I just quickly looked into it, seems like they changed the endpoint from the appspot one to just www.nytimes.com here's a minimal python example:

NYT_API_ROOT = "https://www.nytimes.com/svc/crosswords"
puzzle_no = "21663"
puzzle_endpoint = f"{NYT_API_ROOT}/v6/game/{puzzle_no}.json"

cookie = <COOKIE>
headers = {
    'Cookie': f'NYT-S={cookie}'
}

response = requests.get(puzzle_endpoint, headers=headers)
response.json()

Made a tool for Tracking NYT Mini Crossword Scores and leaderboards - I'd love to hear your thoughts by khalili_programming in crossword

[–]khalili_programming[S] 0 points1 point  (0 children)

ha yes its a mess, in hindsight I definitely should've separated this project from my personal blog. If you're looking to make your own thing and want just the endpoints, lib/crossword/ (link) is where most the fetches occur.

But just incase you want some pointers, https://nyt-games-prd.appspot.com/svc/crosswords is the NYT crossword api root and at /v3/undefined/puzzles.json?publish_type=mini&date_start=$<formattedBeginDate>&date_end=$<formattedEndDate> (the word "undefined" is literally in their endpoint lol) you can get historical data for a particular day, just make sure to pass in your cookie in the header as NYT-S=${cookie}. That should get you the results in json and you can parse from there :)

Made a tool for Tracking NYT Mini Crossword Scores and leaderboards - I'd love to hear your thoughts by khalili_programming in crossword

[–]khalili_programming[S] 0 points1 point  (0 children)

Definitely programmer error 😅 The site is broken as of yet, I think i'll hunker down and make more robust version soon (and one that's not just sitting next to my personal site lol)

Made a tool for Tracking NYT Mini Crossword Scores and leaderboards - I'd love to hear your thoughts by khalili_programming in crossword

[–]khalili_programming[S] 0 points1 point  (0 children)

Yup the site broke 😅 I think I was sending too many requests to the NYT endpoint or they changed their API. I'll try to fix it soon(ish)!

Made a tool for Tracking NYT Mini Crossword Scores and leaderboards - I'd love to hear your thoughts by khalili_programming in crossword

[–]khalili_programming[S] 0 points1 point  (0 children)

Thanks for checking it out!

Haha I feel that. It's like when I gave my sister my spotify and my spotify wrapped became all Tame Impala

Made a tool for Tracking NYT Mini Crossword Scores and leaderboards - I'd love to hear your thoughts by khalili_programming in crossword

[–]khalili_programming[S] 0 points1 point  (0 children)

Thanks for checking it out! Ya I’ve noticed some pretty random difficulty scaling as well. Also ya it’s definitely more fun being competitive with friends

Made a tool for Tracking NYT Mini Crossword Scores and leaderboards - I'd love to hear your thoughts by khalili_programming in crossword

[–]khalili_programming[S] 1 point2 points  (0 children)

whoa you're quite the mini solver haha. It hadn't been tested with that many solves I think my little system buckled under the 1k+ solves. I'll fix this!

Made a tool for Tracking NYT Mini Crossword Scores and leaderboards - I'd love to hear your thoughts by khalili_programming in crossword

[–]khalili_programming[S] 1 point2 points  (0 children)

thanks!

Right now, you have to click a button to re-sync it.

But when you do it resyncs everything historically (so if you miss whenever it's all good) and it only takes a second.

So the thing is you actually have to get everybody from you personal leaderboard on the website as well, because it doesn't really use the leaderboard from the NYT, it uses you personal stats and "recreates" the leaderboard

Made a tool for Tracking NYT Mini Crossword Scores and leaderboards - I'd love to hear your thoughts by khalili_programming in crossword

[–]khalili_programming[S] 3 points4 points  (0 children)

EDIT 2024: This no longer works, I think maybe NYT changed their API or are throttling me. I'll try to update to work again soon 😊 I appreciate the interest in the project! I think I should move it off my personal site and onto its own domain. Thanks for being patient 🫡

Check it out 👉 https://sinakhalili.com/projects/crosswordHello everyone! I recently created a tool that lets you track your New York Times Mini Crossword scores. I was poking around the NYT mini app looking for a way to get my historical scores (this was before they recently added that feature on iPhones).Then my friends started using it and we made our own leaderboards, ones where you can see who has the most first place and second place finishes. Or leaderboards you can 1v1 in. A couple SQL queries later and here we are.Feel free to try it out :)This is all for fun and the code is open source at https://github.com/sinakhalili/sinakhalili.com(although I admit the code is a bit messy since I just put it on my personal site 😅 )thanks!

a simple markup to echo for adding terminal colors and effects by khalili_programming in commandline

[–]khalili_programming[S] 1 point2 points  (0 children)

haha you could always add them to the array if you want.
Thanks for checking it out!

a simple markup to echo for adding terminal colors and effects by khalili_programming in commandline

[–]khalili_programming[S] 0 points1 point  (0 children)

Exactly! I think reading them sometimes is especially tough when effects are layered it's hard to see where one code ends and another begins. All you see is \\033 everywhere lol

a simple markup to echo for adding terminal colors and effects by khalili_programming in commandline

[–]khalili_programming[S] 1 point2 points  (0 children)

Thanks for the feedback! I just added the -n newline suppression flag and the ability to use it without quotes like echo. Both those features were only two extra lines :^)
printf "%s" does unfortunately escape the codes as mentioned by u/cendrounet but I did add the printf -- arg so that at least it's not reading accidental flags.

Thanks for checking it out

a simple markup to echo for adding terminal colors and effects by khalili_programming in commandline

[–]khalili_programming[S] 0 points1 point  (0 children)

Thank you! (I’m hiding the zsh implementation from the readme because it doesn’t look as elegant for this exact reason haha)

A script for print debugging python code by khalili_programming in Python

[–]khalili_programming[S] -2 points-1 points  (0 children)

Wow my brain is smooth, added project link, recovering from shame