Skip to content

Commit

Permalink
feat: ニコニコ動画の動画ページタイトル読み上げへの対応 (#209)
Browse files Browse the repository at this point in the history
* feat: ニコニコ動画の動画ページタイトル読み上げへの対応

* fix: remove debug print
  • Loading branch information
book000 authored Sep 10, 2024
1 parent a5605e4 commit f963866
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ object UrlReplacer : BaseReplacer {
/**
* タイトル要素を取得するための正規表現
*/
private val titleRegex = Regex("<title>([^<]+)</title>", RegexOption.IGNORE_CASE)
private val titleRegex = Regex("<title.*>([^<]+)</title>", RegexOption.IGNORE_CASE)

/**
* URLを表す正規表現
Expand Down Expand Up @@ -344,7 +344,13 @@ object UrlReplacer : BaseReplacer {
var byteArray = ByteArray(0)
val byteLimit = 1024 * 2

client.prepareGet(url).execute {
client.prepareGet(url) {
headers {
append("User-Agent", "VCSpeaker/0.0.0")
append("Accept", "text/html")
append("Accept-Language", "ja-JP")
}
}.execute {
val channel: ByteReadChannel = it.body()

while (!channel.isClosedForRead) {
Expand Down

0 comments on commit f963866

Please sign in to comment.