안드로이드 개발 팁 #46 - HTTPS URL이 유튜브 사이트인지 판별 방법steemCreated with Sketch.

HTTPS URL이 유튜브 사이트인지 판별 방법

No. 46
23.10.03 (화) | Written by @dorian-mobileapp

시작하며…

이런이런... 유튜브 사이트 주소로부터 데이터를 읽는 방법을 이전에 작성했는데요. 먼저 작성해야 할 '유튜브 사이트 인지 판별 방법'을 놓치고 있었네요. 늦었지만 이에 대해 작성하고자 합니다.


유튜브 사이트의 URL

URL이 아래와 같이 시작되면, 유튜브 사이트라고 간주합니다.


유튜브 사이트인지 판별하는 Uri 클래스의 확장 메소드

참고로 String.startsWithOneOf() 메소드는 이전 포스트에서 정의하였습니다.

private const val youtubeSiteTypeA = "https://youtube.com"
private const val youtubeSiteTypeB = "https://m.youtube.com"
private const val youtubeSiteTypeC = "https://www.youtube.com"

fun Uri.isYoutubeSite(): Boolean {
    val address = this.toString()
    return when {
        address.startsWithOneOf(youtubeSiteTypeA, youtubeSiteTypeB, youtubeSiteTypeC) -> true
        else -> false
    }
}

참고 링크


지난 안드로이드 개발 팁


Layout provided by Steemit Enhancer hommage by ayogom


Posted through the ECble app (https://ecble.etain.club)


Posted through the ECblog app (https://blog.etain.club)
Sort:  

[광고] STEEM 개발자 커뮤니티에 참여 하시면, 다양한 혜택을 받을 수 있습니다.

Thank you, friend!
I'm @steem.history, who is steem witness.
Thank you for witnessvoting for me.
image.png
please click it!
image.png
(Go to https://steemit.com/~witnesses and type fbslo at the bottom of the page)

The weight is reduced because of the lack of Voting Power. If you vote for me as a witness, you can get my little vote.

안녕하세요.
SteemitKorea팀에서 제공하는 'steemit-enhancer'를 사용해 주셔서 감사합니다. 개선 사항이 있으면 언제나 저에게 연락을 주시면 되고, 관심이 있으신 분들은 https://cafe.naver.com/steemitkorea/425 에서 받아보실 수 있습니다. 사용시 @응원해 가 포함이 되며, 악용시에는 모든 서비스에서 제외될 수 있음을 알려드립니다.


안녕하세요.
이 글은 SteemitKorea팀(@ayogom)님께서 저자이신 @dorian-mobileapp님을 응원하는 글입니다.
소정의 보팅을 해드렸습니다 ^^ 항상 좋은글 부탁드립니다
SteemitKorea팀에서는 보다 즐거운 steemit 생활을 위해 노력하고 있습니다.
이 글은 다음날 다시 한번 포스팅을 통해 소개 될 예정입니다. 감사합니다!

Upvoted! Thank you for supporting witness @jswit.

Coin Marketplace

STEEM 0.13
TRX 0.35
JST 0.034
BTC 114938.06
ETH 4519.45
SBD 0.88