Add Line Today hybrid listing and additional filters

Fix excessive line wrapping and improve input text styling

(This commit message is AI generated)
This commit is contained in:
yuanhau 2025-05-20 23:42:25 +08:00
parent 9ed90af818
commit 25927ad13c
4 changed files with 77 additions and 2 deletions

View file

@ -74,3 +74,36 @@ The url hash is just what we needed to use my scraper :D
You can query it by using: https://news.yuanhau.com/api/news/get/lt/8nlkYeV (Also videos are in the list, so avoid that) or just try this https://today.line.me/tw/v2/article/8nlkYeV You can query it by using: https://news.yuanhau.com/api/news/get/lt/8nlkYeV (Also videos are in the list, so avoid that) or just try this https://today.line.me/tw/v2/article/8nlkYeV
and that's it, I've bypassed Line's attempt to block people like me. :) and that's it, I've bypassed Line's attempt to block people like me. :)
## More to this debuckle
Apperently, there is something called a "hybrid listing" which is s simple recommendation system from here:` https://today.line.me/webapi/recommendation/hybrid/listings/${id}?country=tw&maxVideoCount=0&offset=0&length=70&optOut=false`, the ID still can be obtained via the same main endpoint, but just different things. Unlike the other api endpoint, it has a higher limit of 70, so you can do more things with it, and this endpoint is even easier to parse via json, just look at it.
```JSON
{
"id": "id",
"items": [
{
"id": "news-id",
"title": "title",
"publisher": "publisher",
"publisherId": "100005",
"publishTimeUnix": 1747712924000,
"contentType": "GENERAL",
"thumbnail": {
"type": "IMAGE",
"hash": "image hash"
},
"url": {
"hash": "67676767",
"url": "https://today.line.me/tw/v2/article/67767676"
},
"categoryId": 100260,
"categoryName": "cattype"
}
]
}
```
This is 100% easier to work with, and with a another extra, I can easily search shitty news terms. Also there is as category type??? What?
Also the id can just work with the following pattern in regex: `news_cat:[a-zA-Z0-9]{24}`

View file

@ -14,6 +14,12 @@
"性侵", "性侵",
"裸照", "裸照",
"性感", "性感",
"找妹" "找妹",
"肉蹼",
"超兇北半球",
"大露",
"色誘",
"死亡",
"撩妹"
] ]
} }

View file

@ -1,19 +1,54 @@
<script setup lang="ts"> <script setup lang="ts">
const errore = ref(false); const errore = ref(false);
const textinput = ref("");
const route = useRoute(); const route = useRoute();
const router = useRouter();
const localePath = useLocalePath();
const article = route.query.article; const article = route.query.article;
const buildUrl = "/api/news/get/lt/" + article; const buildUrl = "/api/news/get/lt/" + article;
if (!article) { if (!article) {
errore.value = true; errore.value = true;
} }
const { data, error, pending } = await useFetch(buildUrl); const { data, error, pending } = await useFetch(buildUrl);
const submitTextInput = () => {
const regexFilterOutUrl =
/https:\/\/today\.line\.me\/tw\/v2\/article\/([^/\s]*)/;
const matches = textinput.value.match(regexFilterOutUrl);
const articleId = matches ? matches[1] : null;
if (articleId) {
window.location.href = localePath(
`/tools/freelinetoday?article=${articleId}`,
);
}
};
</script> </script>
<template> <template>
<div class="justify-center align-center text-center flex flex-col"> <div v-if="errore">
<div
class="absolute inset-0 flex flex-col justify-center align-center text-center w-full h-screen"
>
<h1 class="text-4xl mb-4">無法找到該文章</h1>
<span>複製你的LINE Today 網址</span>
<div
class="flex flex-row gap-2 w-full justify-center align-center text-center"
>
<input
type="text"
v-model="textinput"
class="rounded-xl text-black"
/><button @click="submitTextInput" class="p-2 bg-sky-600 rounded-xl">
送出
</button>
</div>
</div>
<div class="h-screen"></div>
</div>
<div class="justify-center align-center text-center flex flex-col p-3">
<h2 class="text-3xl text-bold">{{ data.title }}</h2> <h2 class="text-3xl text-bold">{{ data.title }}</h2>
<span class="text-lg text-bold" <span class="text-lg text-bold"
>origin: {{ data.origin }} author: {{ data.author }}</span >origin: {{ data.origin }} author: {{ data.author }}</span
> >
<div class="test-center" v-for="item in data.paragraph">{{ item }}</div> <div class="test-center" v-for="item in data.paragraph">{{ item }}</div>
</div> </div>
<div class="min-h-10 sticky h-full"></div>
</template> </template>

View file

@ -16,6 +16,7 @@ export default defineEventHandler(async (event) => {
"性侵", "性侵",
"裸照", "裸照",
"性感", "性感",
"找妹",
], ],
}; };
}); });