Skip to content

Instantly share code, notes, and snippets.

View tzvc's full-sized avatar
💭
that's my status, over

Théo champion tzvc

💭
that's my status, over
View GitHub Profile
@tzvc
tzvc / asyncEnrich.js
Created February 23, 2018 15:13
Enrich data using ES2016 async/await
async function get(type) {
const rottentomatoesResponse = await fetch(`https://www.rottentomatoes.com/api/private/v2.0/browse?sortBy=popularity&type=${type}`)
const json = await rottentomatoesResponse.json()
const titles = json.results.map(element => {
return {
url: element.url,
title: element.title.split(':')[0]
}
});
@tzvc
tzvc / closeme
Created April 5, 2022 14:45
Close own window (don't ask me)
window.onload = function load() {
window.close('','_parent','');
};

If you're getting blocked every 4 requests, it's likely that your IP address is being flagged. One way to work around this is to use a proxy server that will automatically rotate your IP address with each request. This way, you're less likely to get flagged and blocked.

There are a few different ways to do this, but one example is to use residential proxies. These are IP addresses that are associated with real physical locations (homes, businesses, etc.), so they're less likely to be flagged as suspicious.

Some allow scoping to a particular geo region and use "sticky" IPs (use the same IP for a set amount of time)

There are a number of different providers that offer this service, so you'll need to do some research to find one that meets your needs. Once you have a proxy server set up, you can use it in your code just like you would any other proxy.

Here's how it would work in your case:

@tzvc
tzvc / cui.css
Last active October 18, 2022 16:10
cui css
@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap";@import"https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@300;400;500;600;700&display=swap";.dynamite-editable,[data-d-ignore]{outline-offset:-1.5px;pointer-events:all}[data-d-ignore] *{pointer-events:none}body:not(.dynamite-metakey) .dynamite-editable,body:not(.dynamite-metakey) .dynamite-editable *{cursor:text!important}.dynamite-editable:hover{outline:1.5px dotted #2c5ffa}.dynamite-editable:focus{outline:1.5px solid rgba(44,95,250,1);caret-color:#2c5ffa}.dynamite-editable:empty:before{content:attr(placeholder);color:#878787}[data-d-ignore]:hover{outline:1.5px dotted rgb(220,220,220)}.dynamite-editable.dynamite-diff{outline:1.5px dotted rgba(44,95,250,1);color:#2c5ffa}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.dynamite-tooltip{padding:4px 6px;background-color:#000;color:#fff;border-radius:4px;position:absolute;font-size:9px;top:100%;z-index:9999;font-weight:300;animation:fadeIn 50ms ease .5s backwards}.dynam

Custom profiles on selenium-webdriver are sometimes fiddly. Try setting the preferences directly.

Here's the updated code for your example:

import {Builder, WebDriver} from 'selenium-webdriver';
import {Options} from "selenium-webdriver/firefox";

const customUA = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36";
const options = new Options().setPreference('general.useragent.override', customUA);

The first error you encountered was indeed caused by a mismatch in binaries version between Chrome and the WebDriver.

But you've already figured this out, so onto the issue you are facing now:

org.openqa.selenium.NoSuchSessionException: no such session

This error implies that the ChromeDriver was unable to communicate with the existing Browsing Context i.e. Chrome Browser session.

@tzvc
tzvc / afm.md
Last active March 29, 2024 14:06
afm

Use Case: Media Repurposing for Retail Engagement

Explanation and Benefit: Transform long-form media like documentaries and tutorials into captivating short clips for TikTok and Instagram Reels, enhancing social media presence and engagement.

Practical Case: "I am the Digital Marketing Manager at Leroy Merlin, and I want to leverage our extensive library of DIY tutorials and mini-documentaries to engage with a broader audience on social media. By using Klap, I can easily convert these long videos into engaging short clips perfect for TikTok and Reels, instantly boosting our online visibility and customer engagement."

Use Case: Capitalizing on Short-Form Video Shopping Trends

Explanation and Benefit: Lower the barriers to creating high-quality, engaging short videos for showcasing products and tutorials, tapping into the Gen Z market and viral shopping trends like "TikTok made me buy it."

Practical Case: "I am a Product Marketing Specialist at Decathlon, aiming to capitalize on the v