The chances of getting any flavor should be the same

This commit is contained in:
bingus_violet 2024-12-24 03:52:44 -06:00
parent 6dc65275a2
commit 23c07b1146
3 changed files with 15 additions and 12 deletions

View file

@ -1,8 +1,8 @@
import * as path from "path" import * as path from "path"
import { fileURLToPath } from "url" import { fileURLToPath } from "url"
export const flavors = ["#reflectivedetective", "#alearfred", "リュアル"] export const flavors = [["#reflectivedetective"], ["#alearfred", "リュアル"]]
export const variety = 200 export const variety = 5
export const PORT = process.env.PORT || 8080 export const PORT = process.env.PORT || 8080
export const __dirname = path.dirname(fileURLToPath(import.meta.url)) export const __dirname = path.dirname(fileURLToPath(import.meta.url))
export const staticPath = path.join(__dirname, "static") export const staticPath = path.join(__dirname, "static")

View file

@ -8,15 +8,17 @@ await scraper.login(process.env.USERNAME, process.env.PASSWORD)
export async function scrapeYaoi() { export async function scrapeYaoi() {
var finalArray = [] var finalArray = []
for (let flavor of flavors) { for (let typeIndex in flavors) {
console.log(flavor) let types = flavors[typeIndex]
var search = scraper.searchTweets(flavor, variety, "media") finalArray[typeIndex] = []
for (let flavor of types) {
for await (var value of search) { // console.log(flavor)
// console.log(finalArray.includes(value)) var search = scraper.searchTweets(flavor, variety, "media")
if (value.html.includes("img") & !finalArray.includes(value)) {
// console.log(value) for await (var value of search) {
finalArray.push(value) if (value.html.includes("img") & !finalArray.includes(value)) {
finalArray[typeIndex].push(value)
}
} }
} }
} }
@ -26,6 +28,7 @@ export async function scrapeYaoi() {
export var yaoiList = await scrapeYaoi() export var yaoiList = await scrapeYaoi()
export function getYaoi() { export function getYaoi() {
var yaoi = yaoiList[Math.floor(Math.random() * yaoiList.length)] var yaoi = yaoiList[Math.floor(Math.random() * yaoiList.length)]
yaoi = yaoi[Math.floor(Math.random() * yaoi.length)]
return yaoi return yaoi
} }

View file

@ -74,7 +74,7 @@ a {
font-weight: bold; font-weight: bold;
background-clip: text; background-clip: text;
-webkit-text-fill-color: transparent; color: transparent;
transition: transform 2s cubic-bezier(0.075, 0.82, 0.165, 1); transition: transform 2s cubic-bezier(0.075, 0.82, 0.165, 1);
} }