2024-01-30 17:08:29 +00:00
|
|
|
"
|
|
|
|
I manage instagram URLs information.
|
|
|
|
|
|
|
|
InstagramUrl newURL: 'https://instagram.com/restOfURL'
|
|
|
|
"
|
|
|
|
Class {
|
|
|
|
#name : #InstagramUrl,
|
|
|
|
#superclass : #Object,
|
|
|
|
#instVars : [
|
|
|
|
'url'
|
|
|
|
],
|
|
|
|
#category : #Instagram
|
|
|
|
}
|
|
|
|
|
|
|
|
{ #category : #'instance creation' }
|
|
|
|
InstagramUrl class >> newURL: url [
|
2024-01-30 17:50:17 +00:00
|
|
|
| instance |
|
2024-01-30 17:08:29 +00:00
|
|
|
instance := self new.
|
2024-01-30 17:50:17 +00:00
|
|
|
instance url: (instance urlCheck: url).
|
2024-01-30 17:08:29 +00:00
|
|
|
^ instance
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
InstagramUrl >> initialize [
|
|
|
|
| initial |
|
|
|
|
initial := 'https://www.instagram.com' asUrl.
|
|
|
|
super initialize.
|
|
|
|
self url: initial.
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #opening }
|
|
|
|
InstagramUrl >> openWithoutTracking [
|
|
|
|
WebBrowser openOn: self urlWithoutTracking
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
InstagramUrl >> url [
|
|
|
|
|
|
|
|
^ url
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
InstagramUrl >> url: aURL [
|
|
|
|
|
|
|
|
url := aURL
|
|
|
|
]
|
|
|
|
|
2024-01-30 17:50:17 +00:00
|
|
|
{ #category : #testing }
|
|
|
|
InstagramUrl >> urlCheck: aURL [
|
|
|
|
| urlCheck |
|
|
|
|
(aURL includesSubstring: 'instagram.com')
|
|
|
|
ifFalse: [ UIManager default inform: '" ', aURL, ' " it''s not an instagram URL.'.
|
|
|
|
^ self url].
|
|
|
|
urlCheck := aURL asUrl.
|
|
|
|
urlCheck hasHost ifFalse: [ urlCheck host: urlCheck segments first.
|
|
|
|
urlCheck removeFirstPathSegment. ].
|
|
|
|
urlCheck hasScheme ifFalse: [ urlCheck scheme: 'https' ].
|
|
|
|
^ urlCheck
|
|
|
|
]
|
|
|
|
|
2024-01-30 17:08:29 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
InstagramUrl >> urlWithoutTracking [
|
|
|
|
^ self url queryRemoveAll; asStringOrText
|
|
|
|
]
|